[EJB Development] - Entity bean deadlock
by bartatamas
Hi!
I have two entity beans for example: A, B
There is a relation between these beans, and I have to be able to access B from A and A from B.
A: getTitle() {
return name + getB().getName();
}
B: getTitle() {
return name + getA().getName();
}
When a thread calls A.getTitle() and an other thread calls B.getTitle(), there can be a deadlock: thread1 locks A; thread2 locks B; thread1 waits for B; thread2 waits for A -> deadlock
What can I do to avoid these deadlock? Read-only method declaration isn't enough. I have to call the beans from each other. The real situation is much more difficult, it is only a simplified case.
How can I obtain that a get method doesn't lock the bean itself?
Thanks, Tamas
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257064#4257064
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257064
14 years, 7 months
[JBoss Messaging Development] - Compatibility with JGroups 2.8
by bstansberry@jboss.com
Hi,
One of the things I'd like to do for the upcoming AS 5.2 is move to JGroups 2.8. The big impediment to that has been that a number of projects (AS, JBC, JBM) have some code that casts JGroups Address objects from the Address interface used in the API to the IpAddress concrete class that JGroups has historically used. A big change in 2.8 is the Address type is no longer IpAddress.
The use of IpAddress in JBM 1.4.x is in the PostOfficeAddressInfo class, where the cast is done to allow serialization via the JGroups Streamable interface. There's a pretty easy fix for that though, as JGroups exposes a utility method that does what JBM currently does without requiring JBM to cast:
| Index: src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeAddressInfo.java
| ===================================================================
| --- src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeAddressInfo.java (revision 7825)
| +++ src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeAddressInfo.java (working copy)
| @@ -27,7 +27,7 @@
|
|
| import org.jboss.messaging.util.Streamable;
|
| import org.jgroups.Address;
|
| -import org.jgroups.stack.IpAddress;
|
| +import org.jgroups.util.Util;
|
|
|
| /**
|
| *
|
| @@ -70,30 +70,16 @@
|
|
| public void read(DataInputStream in) throws Exception
|
| {
|
| - controlChannelAddress = new IpAddress();
|
| -
|
| - controlChannelAddress.readFrom(in);
|
| -
|
| - dataChannelAddress = new IpAddress();
|
| + controlChannelAddress = Util.readAddress(in);
|
|
|
| - dataChannelAddress.readFrom(in);
|
| + dataChannelAddress = Util.readAddress(in);
|
| }
|
|
|
| public void write(DataOutputStream out) throws Exception
|
| {
|
| - if (!(controlChannelAddress instanceof IpAddress))
|
| - {
|
| - throw new IllegalStateException("Address must be IpAddress");
|
| - }
|
| -
|
| - if (!(dataChannelAddress instanceof IpAddress))
|
| - {
|
| - throw new IllegalStateException("Address must be IpAddress");
|
| - }
|
| + Util.writeAddress(controlChannelAddress, out);
|
|
|
| - controlChannelAddress.writeTo(out);
|
| -
|
| - dataChannelAddress.writeTo(out);
|
| + Util.writeAddress(dataChannelAddress, out);
|
| }
|
|
|
| // Public --------------------------------------------------------
|
So, looking for input from the JBM team as to
a) use of JGroups 2.8 in AS 5.2 in general, i.e. compatibility with JBM
b) possibility of getting the above in a JBM 1.x release for inclusion in AS 5.2.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256953#4256953
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256953
14 years, 7 months
[JBoss AS Development] - JBoss-5.0.0.GA runtime java.sql.Exception - Request help
by Lamab
Could some JBoss guru please kindly help me ? I am desperately trying to a simple JBoss-5.0.0.GA based application to work. Some details:
1. I am using Eclipse Galileo along with JBoss IDE 1.5 for code compiling, jar building and I use a single WAR file and a few jar files
2. I using Java JDK 1.6_11 on a RedHat EL 4 machine. I am using PostgreSQL 8.4, postgres-8.5_107.jdbc.jar, as downloaded from the official Postgres site at www.postgres.org
3. I include the postgres**.jar file in both Eclipse's Java Build Path and in the final WAR file to be used for deployment
4. I have modified JBoss's run.sh so that the JBoss runtime CLASSPATH can access the postgres***.jar file, and I have a simple 'echo' statement to verify that the runtime CLASSPATH includes this jar file
Problem:
I am getting java.sql.***Exception, with the error message that the suitable driver could not be found. In my source file, I have a very standard approach as:
Class.forName("org.postgresql.Driver").newInstance();
con = DriverManager.getConnection(....);
Could someone please help ? I have tried to solve this problem for the last few weeks and tried all possible things, but nothing has worked. Any hints, suggestions would be greatly appreciated. Thanks in advance for your help.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256841#4256841
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256841
14 years, 7 months