[EJB 3.0] - concurrently modifying entity instance
by gsegura
Dear all,
I'm requesting in the kindest way any advise on this issue: concurrent modification of one entity instance.
The following is a simplified scenario, but describes the issue well.
There is this entity which holds a number, one user is in charge of decreasing that magnitude and another one is in charge of incrementing it.
These two are the methods each user is supposed to invoke during interaction with the application.
In consumer's session:
public void decrement() {
| Resource r = manager.find(Resource.class, id);
| while(r.getCounter()>0)
| r.decreaseByOne() ;
| }
In producer's session:
public void increment() {
| Resource r = manager.find(Resource.class, id);
| r.increaseCounterBy(100) ;
| }
Those methods could potentially be invoked simultaneously, so one thing I'd like to prevent is method increment() been called during execution of decrement(), hence I need to either:
1.- serialize those invocations, or
2.- pessimistically lock the entity instance.
For option 2, it is not clear to me how to lock the entity instance 'globally', since each user has his own persistence context entitymanager.lock() won't be enough, right?
For option 1 I don't even have a clue.
best regards,
Gerardo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144711#4144711
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144711
18 years, 3 months
[JBoss Messaging] - Re: MQ migration help
by tnine
Thanks for the help again. I've given up on the JEMS version of JBoss. I was getting very strange serialization issues. As soon as I installed messaging to the "all" server from the 4.2.2GA download and configured the data sources everything started working. Note that I couldn't use the jbossall-client.jar as outlined in the doc, since it conflicted with my version of Hibernate. Would it be possible to list each specific client jar in the doc? I have my client working, but it was a guess and check on the jar files, and I want to be sure I have everything I need.
I'm was also having a bit of a performance issue. When I was using MQ, I could queue up my messages very quickly. My messages are object messages, and they're quite large, between 16k up to 40k (so far). With JBoss MQ I could queue around 500 messages a minute with our current POJO client. With JBoss messaging and the default queues, it takes about 10 minutes to queue 500 messages, then hangs at around 570 messages. I though this may be due to my queue configuration and paging given the large message size. I lowered the memory storage and paging quite a bit, which appears to have fixed my issue. Is this a valid fix, or is there a better way to handle large messages?
Settings
Data Source: DefaultDS
Database Type: MySQL (InnoDB Tables)
Connection Info: java.naming.provider.url=jnp://localhost:1100
Connection Factory JNDI Location: ClusteredXAConnectionFactory
destinations-service.xml
|
| <!-- Input Queue for statements -->
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=StatementInput"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">
| jboss.messaging:service=ServerPeer
| </depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="DLQ">
| jboss.messaging.destination:service=Queue,name=StatementDLQ
| </attribute>
| <attribute name="Clustered">true</attribute>
| <attribute name="MaxDeliveryAttempts">2</attribute>
| <attribute name="FullSize">100</attribute>
| <attribute name="PageSize">50</attribute>
| <attribute name="DownCacheSize">50</attribute>
|
| </mbean>
|
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=StatementOutput"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">
| jboss.messaging:service=ServerPeer
| </depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="DLQ">
| jboss.messaging.destination:service=Queue,name=StatementDLQ
| </attribute>
| <attribute name="Clustered">true</attribute>
| <attribute name="FullSize">100</attribute>
| <attribute name="PageSize">50</attribute>
| <attribute name="DownCacheSize">50</attribute>
| </mbean>
|
|
| <!-- DLQ for statements -->
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=StatementDLQ"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">
| jboss.messaging:service=ServerPeer
| </depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="Clustered">true</attribute>
| <attribute name="FullSize">100</attribute>
| <attribute name="PageSize">50</attribute>
| <attribute name="DownCacheSize">50</attribute>
| </mbean>
|
Thanks,
Todd
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144708#4144708
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144708
18 years, 3 months
[Security & JAAS/JBoss] - How to configure "Negotiate Kerberos"?
by draggy
Hello JBoss experts and professionals,
Currently, IÃÂÃÂÃÂâÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂm using JBoss Portal 2.6.4 bundle with Application server 4.2.2 and referring to http://wiki.jboss.org/wiki/NegotiateKerberos about
| 3. Modify the ${jboss.server.dir}/conf/jboss-service.xml (if you installed via the JBoss Installer Jar, then the file you need to edit is ${jboss.server.dir}/deploy/security-service.xml) in the server you copied the jars to. You need to change the "jboss.security:service=JaasSecurityManager MBean" to use the new callback handler included with the negotiate jar.
| You need to find the mbean definition in the file, and add or change the CallbackHandlerClassName? attribute to be the following:
|
| <attribute name="CallbackHandlerClassName">org.jboss.web.tomcat.security.AdvancedWebCallbackHandler</attribute>
|
| for 4.04 you may need to use ${jboss.server.dir}/deploy/security-service.xml) event it is not installed using the JBoss Installer Jar.
|
| for 4.05 you may need to use ${jboss.server.dir}\deploy\security.sar\META-INF\jboss-service.xml
|
I am not sure how to configure this particular parts:
| You need to find the mbean definition in the file, and add or change the CallbackHandlerClassName? attribute to be the following:
|
| <attribute name="CallbackHandlerClassName">org.jboss.web.tomcat.security.AdvancedWebCallbackHandler</attribute>
|
And
| for 4.04 you may need to use ${jboss.server.dir}/deploy/security-service.xml) event it is not installed using the JBoss Installer Jar.
|
| for 4.05 you may need to use ${jboss.server.dir}\deploy\security.sar\META-INF\jboss-service.xml
|
However, I have managed to find JAAS in my jboss-service.xml:
| <!-- JAAS security manager and realm mapping -->
| <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
| name="jboss.security:service=JaasSecurityManager">
| <!-- A flag which indicates whether the SecurityAssociation server mode
| is set on service creation. This is true by default since the
| SecurityAssociation should be thread local for multi-threaded server
| operation.
| -->
| <attribute name="ServerMode">true</attribute>
| <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
| <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
| <!-- DefaultCacheTimeout: Specifies the default timed cache policy timeout
| in seconds.
| If you want to disable caching of security credentials, set this to 0 to
| force authentication to occur every time. This has no affect if the
| AuthenticationCacheJndiName has been changed from the default value.
| -->
| <attribute name="DefaultCacheTimeout">1800</attribute>
| <!-- DefaultCacheResolution: Specifies the default timed cache policy
| resolution in seconds. This controls the interval at which the cache
| current timestamp is updated and should be less than the DefaultCacheTimeout
| in order for the timeout to be meaningful. This has no affect if the
| AuthenticationCacheJndiName has been changed from the default value.
| -->
| <attribute name="DefaultCacheResolution">60</attribute>
| <!-- DeepCopySubjectMode: This set the copy mode of subjects done by the
| security managers to be deep copies that makes copies of the subject
| principals and credentials if they are cloneable. It should be set to
| true if subject include mutable content that can be corrupted when
| multiple threads have the same identity and cache flushes/logout clearing
| the subject in one thread results in subject references affecting other
| threads.
| -->
| <attribute name="DeepCopySubjectMode">false</attribute>
| </mbean>
|
May I know how to configure it?
Thank you
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144701#4144701
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144701
18 years, 3 months