0

Background: What I need is a way to subscribe to the external system only once during the server startup on clustered environment. So far we were using ApplicationLifecycleListener to run the subscription. In our code we were trying to find a winner node to make the subscription but for some reason it does not work and all 4 are sending their request. (the code was written on Weblogic 8.1) Now after we've migrated to the weblogic 11g I've found a SingletonService that did the trick. Unfortunately we cannot use it as when we develop our application locally we test it on non-cluster environment and Singleton Service does not work on it.

My question: Is there a way to register SingletonService after the application is started and we, eg. in ApplicationLifecycleListener discover that we are on the cluster? If not, do you have any suggestions on how to solve our problem?

  • I'm just guessing here, shouldn't singleton be the singleton regardless of how many servers are running? If it works for 4, it should still work for 1. Or may be I misunderstood the question... – Thihara Mar 20 '13 at 14:25

1 Answers1

0

Can you use a startup class and only target it to one machine instead of all 4? You will need to add the startup class to the server's classpath. You can view startup/shutdown classes in the weblogic console under "Environment".

Here is a brief example: http://buttso.blogspot.com/2009/09/weblogic-server-startup-and-shutdown.html

Display Name is missing
  • 6,197
  • 3
  • 34
  • 46
  • I have encounter with same issue. I want to make my startup class as singleton by implementing the SingletonService interface but implementation of both interface is increased by issue because activate() & startup() in which method do I need to put my code – Maheshwar Ligade Dec 16 '16 at 12:20