?
Solved

Implementation steps for cluster wide singleton - weblogic 9.2 / 10

Posted on 2009-05-17
5
Medium Priority
?
2,410 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 10

Accepted Solution

by:
rajesh_bala earned 252 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 248 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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

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…
The Fluent Interface Design Pattern You can use the Fluent Interface (http://en.wikipedia.org/wiki/Fluent_interface) design pattern to make your PHP code easier to read and maintain.  "Fluent Interface" is an object-oriented design pattern that r…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

771 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