[Messaging, JMS & JBossMQ] - Re: Sequential processing of messages with the same Key
by mzeijen
anonymous wrote : You don't create 700,000 subscriptions that would be a management nightmare. ;-)
| It would also require every send of a message checking 700,000 selectors to see
| which subscription matches the message.
|
| You use a "like", e.g. all customers beginning with A, B, C, etc.
| to divide them into groups according to how much concurreny you need.
|
| Or better yet, you use a "hash" of the customer id if you want a better spread.
I am missing something totally. A queue can process multiple messages at once, depending on the size of the thread pool, right?. Doesn't this create concurrency? If I understood the whole JMS clustering thing then the cluster should make sure that those processes get distributed one the cluster. If I want to make it more scalable then I only make sure that the queue can be processed by more threads and that more machines are available on the cluster. Lets forget about the DB for now, because that will become the bottleneck eventually (if you don't let it scale ;)).
But I see where you are going. Doesn't your solution also mean that a subscription can only have one thread to make sure that it processes all the messages sequentially? Because that would indeed be the solution.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068103#4068103
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068103
18Â years, 9Â months
[EJB 3.0] - Re: what happen with my entity bean , need expert help
by jfheintz
No I have followed your instruction, here is my code:
MySite.java:
package test;
@javax.persistence.Entity
@javax.persistence.Table(name="SI_SITE")
public class MySite {
@javax.persistence.Column(name="siteId")
@javax.persistence.Id
private java.lang.Long siteId;
@javax.persistence.Column(name="name")
private java.lang.String name;
@javax.persistence.Column(name="description")
private java.lang.String description;
@javax.persistence.Column(name="staticSite")
private boolean staticSite;
@javax.persistence.Column(name="status")
private int status;
public MySite() {
}
... getter and setter for the previous attributes
}
The client (part of a session bean):
EjbLocator ejbLocator=EjbLocator.getLocator();
MySite siteEJB3=ejbLocator.find(MySite.class, new Long(1));
EjbLocator.java:
public class EjbLocator {
@PersistenceContext(unitName="StatInfoUnit")
private EntityManager manager;
private static Context ctx;
private static EjbLocator instance = new EjbLocator();
private EjbLocator() {
try {
ctx = new InitialContext();
} catch (NamingException e) {
logger.error(e.getMessage());
}
}
public static EjbLocator getLocator() {
return instance;
}
private T getEjb(Class ejbClass, String name) {
try {
T service = (T) new InitialContext().lookup("Statinfo/" + name
+ "/local");
return service;
} catch (NamingException e) {
return null;
}
}
public T find(Class ejb3Class, Object id) {
return manager.find(ejb3Class, id);
}
public void persist(Object ejb3Object) {
manager.persist(ejb3Object);
}
}
I have a persistence.xml in META-INF dir:
<persistence-unit name="StatInfoUnit">
<jta-data-source>java:/StatInfoDS</jta-data-source>
<!-- Explicitly define mapping file path, else Hibernate won't find the default -->
<mapping-file>META-INF/orm.xml</mapping-file>
test.MySite
<!-- exclude-unlisted-classes=true: Prevent annotation scanning. In this app we are purely driven by orm.xml -->
<exclude-unlisted-classes>false</exclude-unlisted-classes>
org.hibernate.ejb.HibernatePersistence
</persistence-unit>
I have a orm.xml in META-INF dir:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<persistence-unit-metadata>
</persistence-unit-metadata>
</entity-mappings>
Deployment is OK but the exception (Nullpointer) occurs when the client part is called, any idea?
Thanks a lot for your help,
JF
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068102#4068102
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068102
18Â years, 9Â months
[JBossCache] - JBoss Cache 1.4.1 SP3 |Problem with OPTIMISTIC NodeLockingSc
by sg283
We are using JBoss AS 4.0.3 SP1 and JBoss Cache 1.4.1 SP3 and MySQL Server 5.0.18. We are using OPTIMISTIC NodeLockingScheme currently.
We are getting various cache exceptions:-
1- DataVersioning
2- Duplicate Key
3- ReadWriteLock
Because of these errors, our production system gets down.
Here is the exception stack trace:-
ReadWriteLock Exception
26 Jul 07 08:05:36, INFO org.jboss.cache.interceptors.TxInterceptor:invoke:161 There was a problem handling this request
java.lang.InterruptedException
at EDU.oswego.cs.dl.util.concurrent.NullSync.attempt(NullSync.java:38)
at org.jboss.cache.lock.IdentityLock.acquireReadLock(IdentityLock.java:248)
at org.jboss.cache.Node.acquireReadLock(Node.java:417)
at org.jboss.cache.Node.acquire(Node.java:384)
at org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(PessimisticLockInterceptor.java:231)
at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:160)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:186)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:197)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:345)
at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:157)
at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5520)
at org.jboss.cache.TreeCache.put(TreeCache.java:3678)
at com.tg.cache.manager.FareCacheProviderImpl.addToCache(FareCacheProviderImpl.java:104)
at com.tg.ws.abacus.AbacusFareService.putResponseInCache(AbacusFareService.java:615)
at com.tg.ws.abacus.AbacusFareService_1_5.getFaresFromCacheOrWSForRequest(AbacusFareService_1_5.java:189)
at com.tg.ws.abacus.FarePoolHandler.execute(FarePoolHandler.java:29)
at com.tg.ws.abacus.FarePoolHandler.execute(FarePoolHandler.java:15)
at com.tg.parallel.concurrent.JavaConcurrentPoolExecutor$CallableAdapter.call(JavaConcurrentPoolExecutor.java:93)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Duplicate Key Exception
26 Jul 07 08:38:23, ERROR org.jboss.cache.loader.JDBCCacheLoader:insertNode:981 Failed to insert node: Duplicate entry '/fare/JDH/UDR/3' for key 1
com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '/fare/JDH/UDR/3' for key 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1160)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:685)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1400)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1314)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1299)
at org.jboss.cache.loader.JDBCCacheLoader.insertNode(JDBCCacheLoader.java:969)
at org.jboss.cache.loader.JDBCCacheLoader.put(JDBCCacheLoader.java:321)
at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:216)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:197)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:345)
at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:157)
at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5520)
at org.jboss.cache.TreeCache.put(TreeCache.java:3678)
at com.tg.cache.manager.FareCacheProviderImpl.addToCache(FareCacheProviderImpl.java:104)
at com.tg.ws.abacus.AbacusFareService.putResponseInCache(AbacusFareService.java:615)
at com.tg.ws.abacus.AbacusFareService_1_5.getFaresFromCacheOrWSForRequest(AbacusFareService_1_5.java:187)
at com.tg.ws.abacus.FarePoolHandler.execute(FarePoolHandler.java:29)
at com.tg.ws.abacus.FarePoolHandler.execute(FarePoolHandler.java:15)
at com.tg.parallel.concurrent.JavaConcurrentPoolExecutor$CallableAdapter.call(JavaConcurrentPoolExecutor.java:93)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Data Versioning Exception
26 Jul 07 05:36:30, ERROR org.jboss.cache.transaction.DummyTransaction:notifyBeforeCompletion:251 beforeCompletion() failed for tx=org.jboss.cache.transaction.DummyTransaction@b2e747, handlers=[TxInterceptor.LocalSynchronizationHandler(gtx=GlobalTransaction::202712, tx=org.jboss.cache.transaction.DummyTransaction@b2e747)]
java.lang.RuntimeException:
at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(TxInterceptor.java:1091)
at org.jboss.cache.interceptors.OrderedSynchronizationHandler.beforeCompletion(OrderedSynchronizationHandler.java:75)
at org.jboss.cache.transaction.DummyTransaction.notifyBeforeCompletion(DummyTransaction.java:247)
at org.jboss.cache.transaction.DummyTransaction.commit(DummyTransaction.java:54)
at org.jboss.cache.transaction.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:61)
at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:349)
at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:157)
at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5520)
at org.jboss.cache.TreeCache.put(TreeCache.java:3678)
at com.tg.cache.manager.FareCacheProviderImpl.addToCache(FareCacheProviderImpl.java:104)
at com.tg.ws.abacus.AbacusFareService.putResponseInCache(AbacusFareService.java:615)
at com.tg.ws.abacus.AbacusFareService_1_5.getFaresFromCacheOrWSForRequest(AbacusFareService_1_5.java:189)
at com.tg.ws.abacus.FarePoolHandler.execute(FarePoolHandler.java:29)
at com.tg.ws.abacus.FarePoolHandler.execute(FarePoolHandler.java:15)
at com.tg.parallel.concurrent.JavaConcurrentPoolExecutor$CallableAdapter.call(JavaConcurrentPoolExecutor.java:93)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.cache.CacheException: DataNode [/fare/DEL/MAA/8/15/07 12:00 AM] version Ver=3 is newer than workspace node Ver=2
at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.simpleValidate(OptimisticValidatorInterceptor.java:127)
at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.validateNodes(OptimisticValidatorInterceptor.java:101)
at org.jboss.cache.interceptors.OptimisticValidatorInterceptor.invoke(OptimisticValidatorInterceptor.java:66)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.OptimisticLockingInterceptor.invoke(OptimisticLockingInterceptor.java:95)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:135)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:197)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.TxInterceptor.runPreparePhase(TxInterceptor.java:804)
at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(TxInterceptor.java:1069)
... 21 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068093#4068093
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068093
18Â years, 9Â months