Archive for the ‘Application Design’ Category

Java Fix to return IPv4 instead of IPv6

IP address is a unique address/number assigned to each computer/printer/device on internet. It is used to identify a computer on the internet. IPv4 is the most  commonly used Internet Protocol Version, its format is 0.0.0.0 (127.0.0.1) for local address.

The latest version of Internet Protocol to date  (Sept 2014) is IPv6. IPv6 is intended to replace IPv4 but still 96% of the internet traffic is still using IPv4.

If your java program (HttpServletRequest.getRemoteAddr() ) is returning IPv6 format of IP address and you need it to return IPv4 format then you need to add the following JVM param at your server startup.

1
-Djava.net.preferIPv4Stack=true

 

JMS Design Considerations

Java Messaging Service (JMS) Design considerations

There are several things we need to consider while designing application involving JMS. I am involved in designing an application utilizing JMS therefore I made a check list of items needed to be considered.

1) Asynchronous versus Synchronous

Using Asynchronous or Synchronous JMS will be one of the most important factors that will influence the application design.

Synchronous mode

JMS Application Client (JMS consumer) can receive synchronous JMS message for Queue or Topic with the receive method of QueueReceiver or TopicReceiver respectively. If a message is available, the JMS implementation will return it; otherwise, the client’s call waits indefinitely for a message. The receive method has three variants

1)       receive—Receive the next message for this consumer

2)       receive(long timeout)—Receive the next message that arrives within the timeout interval

3)       receiveNoWait—Receive the next message if one is immediately available else returns null

Please note that the thread using receive () method will have to wait until the next message is arrived.

Asynchronous mode

JMS Application client (JMS consumer) can also receive messages asynchronously. The client does not need to wait; whenever a new message is arrived the client listener onMessage method is called. Read full story »

Einfobuzz Site Map