Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrate/create HA-Singleton to jboss 7

I've been using deploy-hasingleton folder in jboss as 6, this allowed me to create a singleton bean that is used to control business information requests from the cluster nodes. These methods are synchronized in order to control the concurrency between nodes (the same data cannot be in different nodes).

Now that I'm migrating to the Jboss 7, and since that deploy-hasingleton folder disappeared, I've been following the official examples:

  • Cluster Link
  • Cluster Link 2

The problem is that theses examples are too trivial, and I couldn't understand where I can place the business logic methods. So I tried to place that logic in the SingletonService, which implements: Service, MyInterface

And I've modified the getValue method to the following:

@Override
    public MyInterface getValue() throws IllegalStateException,
            IllegalArgumentException {

        return this;
    }

On the client side:

@Override
    public List<Long> myMeth(Long arg1, int arg2) {
        LOGGER.log("loadGroups() is called()");
        ServiceController<?> service = CurrentServiceContainer.getServiceContainer().getService(
                GroupDistributorService.SINGLETON_SERVICE_NAME);

        if (service != null) {
            return ((MyInterface ) service.getValue()).getMyMethod(arg1, arg2);
        } else {
            throw new IllegalStateException("Service '" + GroupDistributorService.SINGLETON_SERVICE_NAME + "' not found!");
        }
    }

I doubt that this is the correct approach. And second, this appears to work in the node that contains the master singleton service. However in other nodes, it locks when calling the singleton service, and I get a timeout.

like image 835
DCarvalho Avatar asked Oct 23 '13 11:10

DCarvalho


People also ask

How long does it take to migrate from JBoss to JBoss 7?

Despite the fact that the application is relatively compact and developed on the JEE5 standard, the migration to JBoss 7 and JEE6 took us four weeks. Hence, you won't be able to perform it as a ticket for maintenance because it's just too large. It's never easy to convince Product Owners and other key business stakeholders to value such migrations.

What's new in JBoss 7?

The first significant update for Jboss 7 is here. The migration is significantly more rapid (EJB 3.1 is far better compared to 3.0). Maven annotations should be replaced for them and make sure the initons are singletons. Each of these annotations successfully can be replaced with JPA 20, allowing you to remove them successfully with Hibernate. Dr.

Why is hibernate not working with JBoss 7?

Normally, by default, it is turned off, but not with “JBoss 7.1”. Therefore Hibernate attempts to insert entities with the help of IDs retrieved from a series (making use of a new sequencer) that have previously been used, resulting in a constraint violation.

What is the message broker in JBoss AS 5?

JAX-WS and JMS are the two interfaces we use to communicate with other components. The message broker is “JBoss AS 5”, which is run as a distinct JVM process. This system's component was not permitted to be altered. At last, we utilize JPA to save the results of the processing to the Oracle database.


1 Answers

Several months ago I've posted blog post about using HASingleton in Jboss 7: http://www.kubrynski.com/2013/07/using-ha-singleton-in-jboss-7.html Hope it will help. Be sure that you enabled clustering mode:

<subsystem xmlns="urn:jboss:domain:ee:1.0">
  <global-modules>
    <module name="org.jboss.msc" slot="main">
    <module name="org.jboss.as.clustering.singleton" slot="main">
  </global-modules>
</subsystem>

and that you stick to osgi system, by adding in your pom.xml (to jar/war plugin) such configuraiton:

<configuration>
  <archive>
    <manifestentries>
      <dependencies>
        org.jboss.msc,org.jboss.as.server,
        org.jboss.as.clustering.singleton
      </dependencies>
    </manifestentries>
  </archive>
</configuration>
like image 170
Jakub Kubrynski Avatar answered Nov 15 '22 08:11

Jakub Kubrynski