Arun Gupta is a technology enthusiast, avid runner, author of a best-selling book, globe trotter, a community guy, Java Champion, JavaOne Rockstar, JUG Leader, Minecraft Modder, Devoxx4Kids-er, and a Red Hatter.
Java EE 7 platform added a few new specifications to the platform:
This is highlighted in the pancake diagram shown below:
Several of the existing specifications were updated to fill the gaps and provide a more cohesive platform. Some small, but rather significant additions, were made to the platform to provide defaults for different features. These defaults would lower the bar for application developers to build Java EE applications.
Lets take a look at them.
Java EE 7 made that “beans.xml” optional and provided a default behavior. Now if this file is not bundled, all CDI-scoped beans are available for injection. So any bean with an explicitly specified scope is available for injection. Scopes defined by the CDI specification are listed at docs.oracle.com/javaee/7/api/javax/enterprise/context/package-summary.html. Specifically, here are the scopes defined by CDI:
In addition, two new scopes are introduced in Java EE 7:
So, any bean with these scopes will be available for injection, in other beans only, without the presence of “beans.xml”.
Check it out in action at github.com/javaee-samples/javaee7-samples/tree/master/cdi/nobeans-xml.
Java EE 7 simplified it by providing a default data source with a pre-defined JNDI name.This mean you can inject a data source as:
@Resource DataSource ds;
Also, your persistence.xml can look like:
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="myPU" transaction-type="JTA"/> </persistence>
Note, no <jta-data-source>.
In both of these circumstances, a default data source with JNDI name java:comp/DefaultDataSource
is bound to your application-server specific JDBC resource.
The exact data source in WildFly can be verified using jboss-cli script as:
wildfly-8.1.0.Final> ./bin/jboss-cli.sh --connect --command="/subsystem=datasources:read-resource" { "outcome" => "success", "result" => { "data-source" => {"ExampleDS" => undefined}, "jdbc-driver" => {"h2" => undefined}, "xa-data-source" => undefined } }
Check it out in action at github.com/javaee-samples/javaee7-samples/tree/master/jpa/default-datasource.
@JMSConnectionFactoryDefinition
and @JMSConnectionFactoryDefinitions
that are read by the Java EE 7 runtime and ensures that the ConnectionFactory
specified by these annotations is provisioned in the operational environment.
Similarly, @JMSDestinationDefinition
and @JMSDestinationDefinitions
can be used to create Topics/Queues as part of application deployment.So no more deployment scripts, just include annotation in your code ?
Check it out in action at github.com/javaee-samples/javaee7-samples/tree/master/jms/send-receive.
JMSConnectionFactory
in an appserver-specific way to deploy the application using JMS resources.Injection of a JMS Producer
or Consumer
in Java EE 6 required to get an instance of application-managed or container-managed JMSConnectionFactory
. This factory had to be manually created in an application-server specific way.Providing a default JMSConnectionFactory
simplifies this step further.
JMS 2.0 also introduced JMSContext
as entry point to the simplified API, and it can be injected simply as:
@Inject JMSContext context;
Not specifying a ConnectionFactory
means the default one will be used. And it has the JNDI name of jms/DefaultJMSConnectionFactory
.
The JNDI name may be mapped to the appserver-specific JMS provider. For example, in case of WildFly it is defined as:
./bin/jboss-cli.sh -c --command="/subsystem=messaging/hornetq-server=default/pooled-connection-factory=hornetq-ra:read-resource" { "outcome" => "success", "result" => { "auto-group" => false, "block-on-acknowledge" => false, "block-on-durable-send" => true, "block-on-non-durable-send" => false, "cache-large-message-client" => false, "call-failover-timeout" => -1L, "call-timeout" => 30000L, "client-failure-check-period" => 30000L, "client-id" => undefined, "compress-large-messages" => false, "confirmation-window-size" => -1, "connection-load-balancing-policy-class-name" => "org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy", "connection-ttl" => 60000L, "connector" => {"in-vm" => undefined}, "consumer-max-rate" => -1, "consumer-window-size" => 1048576, "discovery-group-name" => undefined, "discovery-initial-wait-timeout" => undefined, "dups-ok-batch-size" => 1048576, "entries" => [ "java:/JmsXA", "java:jboss/DefaultJMSConnectionFactory" ], "failover-on-initial-connection" => false, "failover-on-server-shutdown" => undefined, "group-id" => undefined, "ha" => false, "initial-connect-attempts" => 1, "initial-message-packet-size" => 1500, "jndi-params" => undefined, "max-pool-size" => -1, "max-retry-interval" => 2000L, "min-large-message-size" => 102400, "min-pool-size" => -1, "password" => undefined, "pre-acknowledge" => false, "producer-max-rate" => -1, "producer-window-size" => 65536, "reconnect-attempts" => -1, "retry-interval" => 2000L, "retry-interval-multiplier" => 1.0, "scheduled-thread-pool-max-size" => 5, "setup-attempts" => undefined, "setup-interval" => undefined, "thread-pool-max-size" => 30, "transaction" => "xa", "transaction-batch-size" => 1048576, "use-auto-recovery" => true, "use-global-pools" => true, "use-jndi" => undefined, "use-local-tx" => undefined, "user" => undefined } }
Check it out in action at github.com/javaee-samples/javaee7-samples/tree/master/jms/send-receive.
These objects allow user to create application threads that are managed by the Java EE server runtime. Once again, a default and pre-configured managed object, with a well-defined JNDI name, is made available for each one of them.
This allows a user to inject a ManagedExecutorService as:
@Resource ManagedExecutorService myExecutor;
instead of:
@Resource(lookup="myExecutorJNDI") ManagedExecutorService myExecutor;
Default ManagedExecutorService in WildFly can be found as:
./bin/jboss-cli.sh -c --command="/subsystem=ee/managed-executor-service=default:read-resource" { "outcome" => "success", "result" => { "context-service" => "default", "core-threads" => 5, "hung-task-threshold" => 60000L, "jndi-name" => "java:jboss/ee/concurrency/executor/default", "keepalive-time" => 5000L, "long-running-tasks" => false, "max-threads" => 25, "queue-length" => 0, "reject-policy" => "ABORT", "thread-factory" => undefined } }
Similarly other default managed objects can be found.
Check out different executors in action at github.com/javaee-samples/javaee7-samples/tree/master/concurrency.
With so many simplifications, why would you not like to use Java EE 7 platform ?
And WildFly is a fantastic application server too
Download WildFly now, and get started!
Contact Information:
i-Cell Mobile Telecom INC
Head Office: 33310 Central Ave, Union City, 94587, United States
Phone: 510-740-8850 or +1 510-740-8850 (outside United States)
Fax: +1 912 4 239 5857
Email: info.ictelecom @ gmail.com
Skype: info.ictelecom
i-CELL MOBILE TELECOM is an Approved dealers,specialized in the distributors of Mobile phones,Laptops,Games,Mobile accessories,computer e.t.c. Our objective is to develop long-term relationships with our customers.To do so we continuously provide our existing customers new products, advanced designs, and patented innovations so that they can stay on the top of their markets. We offer a 90 days return policy,and offer a secured & reliable payment method to all our existing & first time buyers.We ship out worldwide through Professional and reliable courier company e.g FEDEX EXPRESS ,DHL and UPS within
38hrs of contract sealed. Customers never experience what is called Breach of contract since our operation.Fidelity guarantee our service,our product are 100% international warranty and guarantee.Contact us today for your order at our
marketing.
Our BONANZA are:
Buy 2Units and get 1 unit FREE BONUS.
Buy 5 units and get 2 unit FREE including shipping
Buy 20 Units and get 5 Units FREE including 10% Discount FREE.
Why buy from us?
Lowest Prices Checked,Huge Product Range, 24/7, Online Support, Fast Shipping Guaranteed, Safety and Security assured.Our phones are imported from USA,Finland,Hungary and Singapore; they are factory unlocked, sealed with original packets comes with complete accessory, e.g. charger, extra battery and software c d. The phones are sim free and it’s never lock to any network, specification: (europeans/usa-specifications) general network gsm 900/gsm 1800/gsm 1900 platform – tri band gsm900 + 1800 + 1900 MHz: country of manufactured origin: USA,Finland,Hungary, South Korea and Singapore.All products consist the
following accessories.
1. Complete accessories(Well packed and sealed in original company box)
2. Unlocked / sim free.
3. Brand new (original manufacturer) box – no copies
4. All phones have English language as default
5. All material (software, manual) – car chargers – home chargers – usb data cables -holsters/belt clips – wireless
headsets(bluetooth) -leather and non-leather carrying cases – batteries.If you are interested, forward your questions and inquires to us via email your order and shipping details. we give 12 Months warranty for every product sold out to our costumers, our product are company tested and approved by global standard organization of wireless industries.
1. Guarantee 12 Months.
2. 100% high quality product assurance
3. Accept the exchange for own defect within 2 weeks
4. Best after-sale service
Brands We Stock:
Samsung Galaxy Note 2
$270.00
Samsung Galaxy Note 3
$280.00
Samsung Galaxy Note 4
$300.00
Samsung Galaxy s5
$310.00
Samsung Galaxy s5 Mini
$320.00
Samsung Galaxy s4
$300.00
Samsung Galaxy s3
$270.00
samsung galaxy s4 mini
$280.00
samsung galaxy tab 3
$270.00
Samsung Galaxy Star Trios S5283
$270.00
SONY:
Sony Xperia Z1 Smartphone (Unlocked, Purple)
$270.00
Sony Xperia Z2
$300.00
Sony Xperia Go
$199.00
Sony Xperia C3 Dual
$200.00
Sony Xperia Z2 Tablet LTE
$299.00
Sony Xperia E1
$250.00
Blackberries:
Blackberry classic q20
$350.00
BlackBerry Z3
$250.00
BlackBerry Porsche Design P’9982
$580.00
BlackBerry Z30
$310.00 USD
Blackberry Q10
$270.00 USD
Blackberry Q5
$260.00 USD
BlackBerry 4G LTE PlayBook
$300.00 USD
HTC:
HTC One M8 Dual-SIM
$ PRICE ON REQUEST
HTC Desire 516 Dual-SIM
$
HTC One mini 2
$
HTC One Max
$
APPLE:
Apple iPhone 4s
$
Apple iPhone 5
$
Apple iPhone 5s
$
Apple iPhone 5c
$
IPAD:
Apple iPad 4
$
Apple iPad Mini
$
Apple iPad 5 Air Wi-Fi + 4G 128GB
$360.00 USD
Apple iPad 5 Air Wi-Fi + 4G 64GB
$350.00 USD
Apple iPad 5 Air Wi-Fi + 4G 32GB
$300.00 USD
Apple iPad 5 Air Wi-Fi + 4G 16GB
$270.00 USD
KINDLY PLACE YOUR ORDER IN THE BELOW MANNER SO THAT WE CAN PROCEED ON PACKAGING AND LABELING IMMEDIATELY
FULL NAME ==
PRODUCTS BRAND AND MODEL ==
QUANTITY ==
ADDRESS ==
CITY ==
ZIP CODE ==
COUNTRY ==
MOBILE/TELEPHONE NUMBER & COUNTRY DIALING CODE==
RETURN POLICY
*************
You may return the item within ten (10)days of delivery of the order.Products with Manufacturer Warranties which exceed 30 days,returned directly to the manufacturer according to their instruction, Customer may request replacement product otherwise Company credit will be issued.
OUR TERMS
*********
We ship to any destination within 38hours by USPS, UPS,DHL, TNT and FedEx Express Service, We give tracking # after confirming your payment for the types and pcs you demand. We use reputable courier services of your choice for Distribution of our goods worldwide!All currency are in United State Dollars, Visit (XE – The World’s Favorite Currency and Foreign Exchange Site)in order to Calculate the cost of conversion of your order.
SALES & INFO ENQUIRY: +1(510) 740-8850, FAX NO:+1 912 4 239 5857
Email:
Skype: info.ictelecom
I-CELL MOBILE TELECOM INC TODAY FOR ALL KINDS OF MOBILE PDA AND COMPUTER ACCESSORIES.
Thanks, nice tips.