File tree Expand file tree Collapse file tree 9 files changed +131
-0
lines changed Expand file tree Collapse file tree 9 files changed +131
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM airhacks/glassfish
2+ COPY ./target/corejav.war ${DEPLOYMENT_DIR}
Original file line number Diff line number Diff line change 1+ # Build
2+ mvn clean package && docker build -t com.javaprogramtto/corejav .
3+
4+ # RUN
5+
6+ docker rm -f corejav || true && docker run -d -p 8080:8080 -p 4848:4848 --name corejav com.javaprogramtto/corejav
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ mvn clean package && docker build -t com.javaprogramtto/corejav .
3+ docker rm -f corejav || true && docker run -d -p 8080:8080 -p 4848:4848 --name corejav com.javaprogramtto/corejav
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
3+ <modelVersion >4.0.0</modelVersion >
4+ <groupId >com.javaprogramtto</groupId >
5+ <artifactId >corejava</artifactId >
6+ <version >0.0.1-SNAPSHOT</version >
7+ <packaging >war</packaging >
8+ <dependencies >
9+ <dependency >
10+ <groupId >javax</groupId >
11+ <artifactId >javaee-api</artifactId >
12+ <version >8.0</version >
13+ <scope >provided</scope >
14+ </dependency >
15+ <dependency >
16+ <groupId >org.eclipse.microprofile</groupId >
17+ <artifactId >microprofile</artifactId >
18+ <version >2.0.1</version >
19+ <type >pom</type >
20+ <scope >provided</scope >
21+ </dependency >
22+ </dependencies >
23+ <build >
24+ <finalName >corejav</finalName >
25+ </build >
26+ <properties >
27+ <maven .compiler.source>1.8</maven .compiler.source>
28+ <maven .compiler.target>1.8</maven .compiler.target>
29+ <failOnMissingWebXml >false</failOnMissingWebXml >
30+ </properties >
31+ </project >
Original file line number Diff line number Diff line change 1+ package com .airhacks ;
2+
3+ import javax .ws .rs .ApplicationPath ;
4+ import javax .ws .rs .core .Application ;
5+
6+ /**
7+ * Configures a JAX-RS endpoint. Delete this class, if you are not exposing
8+ * JAX-RS resources in your application.
9+ *
10+ * @author airhacks.com
11+ */
12+ @ ApplicationPath ("resources" )
13+ public class JAXRSConfiguration extends Application {
14+
15+ }
Original file line number Diff line number Diff line change 1+ package com .airhacks .ping .boundary ;
2+
3+ import javax .inject .Inject ;
4+ import javax .ws .rs .GET ;
5+ import javax .ws .rs .Path ;
6+ import org .eclipse .microprofile .config .inject .ConfigProperty ;
7+
8+ /**
9+ *
10+ * @author airhacks.com
11+ */
12+ @ Path ("ping" )
13+ public class PingResource {
14+
15+ @ Inject
16+ @ ConfigProperty (name = "message" )
17+ String message ;
18+
19+ @ GET
20+ public String ping () {
21+ return this .message + " Jakarta EE with MicroProfile 2+!" ;
22+ }
23+
24+ }
Original file line number Diff line number Diff line change 1+ package com .javaprogramto .threads ;
2+
3+ public class ThreadJoinExample {
4+
5+ public static void main (String [] args ) throws InterruptedException {
6+ System .out .println ("main thread started execution. Current thread name : " + Thread .currentThread ().getName ());
7+ PrintNumbers t1 = new PrintNumbers (1 , 10 );
8+ PrintNumbers t2 = new PrintNumbers (11 , 20 );
9+ PrintNumbers t3 = new PrintNumbers (21 , 30 );
10+
11+ t1 .start ();
12+ t1 .join ();
13+
14+ t2 .start ();
15+ t2 .join ();
16+
17+ t3 .start ();
18+ t3 .join ();
19+
20+ System .out .println ("All threads completed excution." );
21+ System .out .println (Thread .currentThread ().getName () + " complete execution" );
22+ }
23+
24+ }
25+
26+ class PrintNumbers extends Thread {
27+
28+ private int start ;
29+ private int end ;
30+
31+ public PrintNumbers (int start , int end ) {
32+ this .start = start ;
33+ this .end = end ;
34+ }
35+
36+ @ Override
37+ public void run () {
38+ for (int i = start ; i <= end ; i ++) {
39+ System .out .println (Thread .currentThread ().getName () + " - " + i );
40+ }
41+ System .out .println (Thread .currentThread ().getName () + " thread execution completed." );
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ message =Enjoy
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <beans xmlns =" http://xmlns.jcp.org/xml/ns/javaee"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
5+ bean-discovery-mode =" all" version =" 2.0" >
6+ </beans >
You can’t perform that action at this time.
0 commit comments