Skip to content

Commit dd5c70d

Browse files
committed
Release of v0.1.0-beta.6 adds bash scripts for GNU/Linux and FreeBSD for the CBrew and Native libraries.
Install script for CBrew and Native libraries. Updated supporting documentation with instructions on how to install install the CBrew and Native libraries. Added templates folder to cbrew main Added freebsd installer script and updated root directory for clearer directory structure. Added further organization from previous commit. Update install-freebsd.sh [maven-release-plugin] prepare release v0.1.0-beta.6 [maven-release-plugin] prepare for next development iteration Set theme jekyll-theme-hacker
1 parent fb27ce6 commit dd5c70d

37 files changed

+228
-47
lines changed

.gitattributes

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
*.so linguist-language=C
2-
3-
*.h linguist-language=Shell
4-
5-
*.class linguist-language=Shell
6-
7-
*.yml linguist-language=Java
1+
*.h linguist-language=C
82

93
*.md linguist-language=GCC-Machine-Description

README.md

Lines changed: 126 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,65 +8,77 @@
88
[![DepShield Badge](https://depshield.sonatype.org/badges/nealkumar/JBrew/depshield.svg)](https://depshield.github.io)
99
[![Gitter](https://img.shields.io/gitter/room/DAVFoundation/DAV-Contributors.svg?style=flat-square)](https://gitter.im/Concurrent-Tasks/community)
1010
[![License](https://img.shields.io/badge/License-BSD%203--Clause%20Clear-blue)](https://spdx.org/licenses/BSD-3-Clause-Clear.html)
11-
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/nealkumar/JBrew)](https://github.com/nealkumar/JBrew/pulse)
11+
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/nealkumar/JBrew?label=Release%20Activity)](https://github.com/nealkumar/JBrew/pulse)
1212
[![OSS Lifecycle (branch)](https://img.shields.io/osslifecycle/nealkumar/JBrew?color=yellow)](https://github.com/Netflix/osstracker)
1313
[![JDK 1.8+](https://img.shields.io/badge/jdk-1.8%2B-purple)](https://www.oracle.com/java/technologies/javase-jdk13-downloads.html)
14-
# JBrew Home
15-
* Please note, the master branch is always live! The latest release is reflected on <code>master</code>.
16-
* The branch <code>staged-for-release</code> reflects the newest updates to the library which will be officially released in the next release iteration. New contributors should make pull requests into <code>staged-for-release</code>.
14+
# JBrew Home ![](https://storage.googleapis.com/documentation.jbrew.org/Favicon%20Logo.png)
15+
* Please note, the master branch is always live! The latest stable release is reflected on <code>master</code>.
16+
* The branch <code>staged-for-release</code> contains the most recent nightly builds and includes the newest features which will be added to the library to be officially released to Maven Central (after the current development iteration). New contributors should make pull requests into <code>staged-for-release</code>.
1717
* To dive into the concurrency library's source code, please navigate [here](https://github.com/nealkumar/JBrew/tree/docpatch-010/concurrent). The README.md contains information on how to get started, and full documentation is available at [jbrew.org](https://jbrew.org/).
1818
* Feedback is always welcome, and can be submitted to [support@jbrew.org](mailto:support@jbrew.org). Thank you!
1919

20+
# User Installation
21+
Note that contributors or other users who wish to use the latest nightly build should follow the [Upstream Installation](#upstream-installation) guide.
22+
## GNU/Linux (Red Hat Enterprise, Fedora, CentOS, Ubuntu, Debian, Arch, Clear), FreeBSD (11.2+)
23+
1. Simply download the file "install.sh" above. FreeBSD users should use the file "install-freebsd.sh" instead.
24+
2. At your desired java.library.path, run "install.sh" in the terminal, like so:
25+
* <code>./install.sh</code> will install to the current directory, OR
26+
* <code>./install.sh /path/to/java.library.path</code> will install to the directory specified.
27+
3. You may be prompted to enter sudo password. Note that no text or cursor movement will appear on screen.
28+
* <code>[sudo] password for user: </code>&nbsp;Enter your credentials, then hit <code>[Enter]</code>.
29+
4. Your installation is complete! ***Important:*** Make sure you set your java.library.path to the location specied in part 2, appended with /bin (Ex: <code>java.library.path=/path/in-part2/bin)</code> before compiling your code, as these libraries have links to native libraries.
30+
* Essentially, whenever you run the <code>java</code> command, you will need to add <code>-Djava.library.path=path/to/where-you-ran/install.sh/in-step-2/bin</code> (Don't forget to append "/bin" to the end of the location!). More detailed istructions can be found [here](https://examples.javacodegeeks.com/java-basics/java-library-path-what-is-it-and-how-to-use/). Just remember to append "/bin"!
31+
* For Maven JUnit tests, it is reccomended you add the Apache Surefire plugin and provide the java.library.path as a compiler argument. [Use these instructions](https://stackoverflow.com/questions/10226082/surefire-junit-testing-using-native-libraries) if you are unsure how to do this.
2032
# JBrew Maven Dependencies
21-
<p>The following libraries are available as Maven depdendencies, which can be inserted into your project's <code>pom.xml</code>.</p>
33+
<p>The following libraries are synchronixed with Maven Central, and can be inserted into your project's <code>pom.xml</code> as a dependency.</p>
2234

2335
## Concurrency Library
2436
```xml
2537
<dependencies>
2638
<dependency>
2739
<groupId>org.jbrew</groupId>
2840
<artifactId>concurrent</artifactId>
29-
<version>0.1.0-beta.5</version>
41+
<version>0.1.0-beta.6</version>
3042
</dependency>
3143
</dependencies>
3244
```
33-
## CBrew JNI Library
45+
## CBrew JNI Library (See [User Installation Guide](#user-installation) before using)
3446
```xml
3547
<dependencies>
3648
<dependency>
37-
<groupId>org.jbrew.native</groupId>
38-
<artifactId>native-core</artifactId>
39-
<version>0.1.0-beta.5</version>
49+
<groupId>org.jbrew.cbrew</groupId>
50+
<artifactId>cbrew</artifactId>
51+
<version>0.1.0-beta.6</version>
4052
</dependency>
4153
</dependencies>
4254
```
43-
## CBrew Libary Validators
55+
## CBrew Libary Validators (See [User Installation Guide](#user-installation) before using)
4456
```xml
4557
<dependencies>
4658
<dependency>
47-
<groupId>org.jbrew.native</groupId>
48-
<artifactId>native-validators</artifactId>
49-
<version>0.1.0-beta.5</version>
59+
<groupId>org.jbrew.cbrew</groupId>
60+
<artifactId>cbrew-validators</artifactId>
61+
<version>0.1.0-beta.6</version>
5062
</dependency>
5163
</dependencies>
5264
```
53-
## Native Libary Validators
65+
## Native Libary Validators (See [User Installation Guide](#user-installation) before using)
5466
```xml
5567
<dependencies>
5668
<dependency>
5769
<groupId>org.jbrew.native</groupId>
5870
<artifactId>native-validators</artifactId>
59-
<version>0.1.0-beta.5</version>
71+
<version>0.1.0-beta.6</version>
6072
</dependency>
6173
</dependencies>
6274
```
63-
## Native Library Core
75+
## Native Library Core (See [User Installation Guide](#user-installation) before using)
6476
```xml
6577
<dependencies>
6678
<dependency>
6779
<groupId>org.jbrew.native</groupId>
68-
<artifactId>native-core</artifactId>
69-
<version>0.1.0-beta.5</version>
80+
<artifactId>native</artifactId>
81+
<version>0.1.0-beta.6</version>
7082
</dependency>
7183
</dependencies>
7284
```
@@ -76,7 +88,7 @@
7688
<dependency>
7789
<groupId>org.jbrew.core</groupId>
7890
<artifactId>annotations</artifactId>
79-
<version>0.1.0-beta.5</version>
91+
<version>0.1.0-beta.6</version>
8092
</dependency>
8193
</dependencies>
8294
```
@@ -86,15 +98,15 @@
8698
<dependency>
8799
<groupId>org.jbrew.core</groupId>
88100
<artifactId>jbrew-core</artifactId>
89-
<version>0.1.0-beta.5</version>
101+
<version>0.1.0-beta.6</version>
90102
</dependency>
91103
</dependencies>
92104
```
93-
# Installation
94-
To install the JBrew library locally, simple clone this libary from <code>master</code> or any other branch needed for development. Next, run "mvn package" at the project's
105+
# Upstream Installation
106+
To install the JBrew library locally, simple clone this libary from the branch <code>staged-for-release</code> to get the latest nightly build. Next, run "mvn package" at the project's
95107
root directory. If you receive errors, please proceed to follow the installation steps below for your specific operating system.
96-
## Linux
97-
Linux is supported as the primary development for JBrew. As such, no additional configuration is needed for most Linux distros. JBrew is actively tested on the
108+
## GNU/Linux
109+
The GNU/Linux is supported as the primary development for JBrew. As such, no additional configuration is needed for most Linux distros. JBrew is actively tested on the
98110
following Linux distrubtions:
99111
* RHEL 8.1/8.2, CentOS, Fedora
100112
* RHEL 7.0+
@@ -103,11 +115,97 @@ following Linux distrubtions:
103115
* Ubuntu
104116
## FreeBSD 12.1+
105117
As of release v0.1.0-beta.4, FreeBSD is now supported as part of the CBrew and Native libraries! TO configure JBrew for BSD, simply update the <code>java.library.path</code>
106-
from <code>$(user.home}/bin/</code> to <code>${user.home}/binbsd/</code>. The reason for this configuration is that by default, C executables are packaged for
118+
from <code>$(user.home}/bin/</code> to <code>${user.home}/bin/freebsd/</code>. The reason for this configuration is that by default, C executables are packaged for
107119
Linux systems. There are slight variances for FreeBSD systems which must be accounted for, and as such a seperate binaries folder was created to house all FreeBSD
108120
C libraries for CBrew and Native.
109121
## Windows 10+
110122
As of release v0.1.0-beta.3, Windows 10+ is now supported as part of the CBrew and Native libraries! No additional configuration is needed, as windows dynamically
111123
linked libraries are packaged as part of the standard release process.
112-
## Solaris OS
113-
At the moment, SolarisOS is <i>not</i> supported by JBrew. If you would like Solaris support, please open an issue detailing your request.
124+
## Solaris
125+
At the moment, SolarisOS is <i>not</i> supported by JBrew. If you would like Solaris support, please open an issue detailing your request.
126+
# JBrew Java Concurrency Library
127+
The Concurrent Tasks Library is an easy-to-consume Java concurrency library allowing for "Tasks" to execute business logic in a thread safe manner. This library helps users achieve multi-threading in their applications without worrying about synchronization and blocking for race conditions. Presently, there are 2 types of Tasks: Retrievable and Non-Retrievable.
128+
<br/>
129+
<i>Please note, the below content is relavent only for v0.0.1 - v0.0.4 of the JBrew concurrency library. For v0.0.5 and above, please refer to the official documentation at [jbrew.org](https://jbrew.org/). README documentation will be updated with the Release Candidate release of v0.1.0-rc.</i>
130+
### Retrievable Tasks
131+
Once <code>RetrievableTask</code> is extended, this allows for <code>@ThreadSafe</code> concurrent execution where business logic executed <i>does</i> need to return back an object. As a result, calling the getVal() method for a Retrievable task returns the object of type T (via use of Java generics) - which is blocked until all logic in the execute() method has terminated.
132+
<br/><br/>
133+
Example usages: Api calls, I/O, or any other situation warranting concurrent parallel processing.
134+
<br/><br/>
135+
Note that classes extending RetrievableTask.java should explicity specify object type in the class declaration to enable compile-type type checking. See example:
136+
```java
137+
public class ExampleTask extends RetrievableTask<String>{}
138+
```
139+
140+
Finally to return the value, one simple has to set the value for <code>obj</code> or <code>this.obj</code>, as such:
141+
142+
```java
143+
public class ExampleTask extends RetrievableTask<String>{
144+
@Overide
145+
protected void execute(){
146+
//do work, execute business logic
147+
148+
//then set the return value for ExampleTasks's object
149+
this.obj = "Example task successfully completed";
150+
}
151+
}
152+
```
153+
### Non-Retrievable or Basic Tasks
154+
Once <code>NonRetrievableTask</code> or <code>BasicTask</code> has been extended, this allows for simple concurrent execution where the business logic executed <i>does <b>not</b></i> need to return back an object. As a result, calling the getVal() method for a NonRetrievableTask throws an <code>java.lang.UnsupportedOperationException</code>.
155+
</br></br>
156+
Example usages: initializers, message dispatchers, or any standalone time-consuming task which you would like to execute concurrently.
157+
# Client Usage Examples
158+
Regardless on the type of <code>Task</code> needed, each respective <code>Task</code> should be wrapped within with a <code>Thread</code> and will begin execution upon calling of the <code>start()</code> or <code>run()</code> methods. The <code>start()</code> method executes the <code>Task</code> in a new thread, while the <code>run()</code> method executes the <code>Task</code> in the same thread.
159+
<br/><br/>Below is an example of a <code>RetrievableTask</code> and <code>NonRetrievable</code> executing business logic in new threads, and then printing out status messages - based on the designated <code>Task</code> type.
160+
```java
161+
public class Main{
162+
163+
private Task retrievable, nonRetrievable;
164+
165+
public static void main(String[] args){
166+
retrieveable = new RTask();
167+
nonRetrievable = new NRTask();
168+
169+
//start the Retrievable Task
170+
Thread t = new Thread(retrievable);
171+
t.start();
172+
//start the Non-Retrievable Task using an anonymous Thread
173+
new Thread(nonRetrievable).start();
174+
175+
//Print the results of each respective Task
176+
System.out.println(retrievable.getVal()); // Since this is a RetrievableTask, retrievable.getVal()
177+
// is blocked until its execute() method has completed.
178+
}
179+
180+
private static class RTask extends RetrievableTask<String>{
181+
@Override
182+
protected void execute(){
183+
//do work, execute business logic
184+
//...
185+
this.obj = "Finished with Retrievable task!";
186+
}
187+
}
188+
189+
private static class NRTask extends NonRetrievableTask{
190+
@Override
191+
protected void execute(){
192+
//do work, execute business logic
193+
//...
194+
System.out.println("Finished with Non-Retrievable task!");
195+
}
196+
}
197+
198+
}
199+
```
200+
Console:</br>
201+
```
202+
Thread #2 started...
203+
Thread #1 started...
204+
Finished with Retrievable task!
205+
Finished with Non-Retrievable task!
206+
```
207+
# CBrew
208+
This library contains native facade implementations of the JBrew utility libraries with the Java Native Interface
209+
(JNI). This set of libraries features specific optimizations for Unix-based systems in terms of performance
210+
and memory. This is achieved through careful tuning using the C programming language to not only control for
211+
garbage collection, but also to ensure maximum performance for elected library features.

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-hacker
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
669 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)