Solved

Implementation steps for cluster wide singleton - weblogic 9.2 / 10

Posted on 2009-05-17
5
2,336 Views
Last Modified: 2013-12-10
I would like to have the steps to implement a cluster wide singleton in Weblogic. My singleton class is the connection pool which has to be available through out the cluster.
0
Comment
Question by:lsivasailam
  • 3
5 Comments
 
LVL 10

Accepted Solution

by:
rajesh_bala earned 63 total points
ID: 24409788
Why do you need singleton for connection pool. Is it mandatory to have your class as singleton?.

Though it might be possible to tie your class in JNDi to achieve singleton behaviour, weblogic might not recommend it.

Another option is to try terracota which provides this feature. But first of all, double check if you really need singleton for connection pool alone.


~Rajesh.B
0
 
LVL 1

Assisted Solution

by:ctoan
ctoan earned 62 total points
ID: 24488179
You can very easily create a custom singleton service in weblogic server. Here are the steps :

1) Make sure your class extends weblogic.cluster.singleton.SingletonService

http://e-docs.bea.com/wls/docs100/javadocs/weblogic/cluster/singleton/SingletonService.html

Example:

I have an interface
public interface SingletonTestService extends SingletonService, Remote {

}

I also have an impl class

public class SingletonTestServiceImpl implements SingletonTestService {

2) Compile and run rmic on it ( I also jar it)

Example:

  <target name="compile" >
            <javac srcdir="${src}"
               destdir="${build}"
                   classpath="${my.classpath}"
               deprecation="${deprecation}"
               debug="${debug}"
               optimize="${optimize}"
               source="1.6" />
   </target>  
   
   <target name="rmi" description="" >      
      <rmic debug="true" destdir="${build}"
              eos="false" clusterable="false" dgcPolicy="managed"
              classname="com.mycompany.foo.SingletonTestServiceImpl"/>      
   </target>  

   <target name="jar" description="jars the singleton service" >      
            <jar jarfile="${dist}/singletonservice.jar"
                  basedir="${build}" includes="com/**"/>
   </target>

3) Make sure it is in the classpath for every cluster member. You can ensure this by dropping the jar in the DOMAIN/lib directory

4) Configure the Singleton Service using weblogic server admin console or WLST

For admin console : login > cluster > singleton service

0
 
LVL 1

Expert Comment

by:ctoan
ID: 24488225
Please note you can implement the activate() method to perform setup operations needed for your service to function. This is guaranteed to execute on any one of the servers when your service activates. Also, there is a corresponding deactivate method.

http://e-docs.bea.com/wls/docs100/javadocs/weblogic/cluster/singleton/SingletonService.html 

If you shutdown / kill the server on which the custom service is activated, you will see that it automatically activates on a different server in the cluster.

However, you may have to setup leasing (if you have not already done it) for this functionality to work
http://e-docs.bea.com/wls/docs103/cluster/migration.html#wp1047105
0
 
LVL 1

Expert Comment

by:ctoan
ID: 24488330
Checkout the official documentation at http://e-docs.bea.com/wls/docs103/cluster/service_migration.html#wp1051458

Section :Implementing the Singleton Service Interface
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java environment settings, edit via *.properties file? 3 69
Question to Java runtime 10 145
sumDigits challenge 9 120
How do I pass arguments in a Builder design pattern ? 10 66
Pretext and Context In previous  (http://www.experts-exchange.com/Programming/Theory/Software-Design/A_4457-System-Data-Modeling-Series-Identity-Management-System-Basic-System.html)article, I designed the data model of a basic Identity Management…
The CRUD Functions CRUD, meaning "Create, Read, Update, Delete (http://en.wikipedia.org/wiki/Create,_read,_update_and_delete)" is a common term to data base developers.  It describes the essential functions of data base table maintenance.  This art…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now