[Design of JBossCache] - Re: New state transfer in JBoss Cache
by bstansberry@jboss.com
anonymous wrote : D doesn't care about conflicting remote prepares since at least someone else in the cluster would have detected this and the prepare would roll back anyway.
|
Here's the specific scenario I was thinking about when I mentioned "one concern is D receives things in different order than A did due to message retransmission."
You've got {A, B, C} with new joiner D.
Messages as seen by {A, B, C}
1) B:PREPARE-TX1
2) B:COMMIT-TX1
3) C:PREPARE-TX2
4) C:COMMIT-TX2
TX1 and TX2 have a locking conflict, but there is no issue due to above ordering.
But, D has a hiccup and drops message 2, requiring JGroups retransmission. Our JGroups stacks don't provide total ordering, just ordering from the same sender. So, now D sees and queues the sequence as:
1) B:PREPARE-TX1
2) C:PREPARE-TX2 -- oops blocks!!
3) B:COMMIT-TX1 -- doesn't get taken off queue due to block
4) C:COMMIT-TX2
When D drains the queue, message #2 will block due to lock conflict, preventing the needed message #3.
JGroups' concurrent stack avoids that kind of problem during normal operation by allowing the B and C messages to be processed in parallel. :-) But, as soon as you introduce a single queue, you can get the problem back again. (The message reordering thing I mentioned was meant to help deal with that by scanning the queue and trying to handle B:COMMIT-TX1 before C:PREPARE-TX2.)
This is kind of an edge case, but it's there.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113531#4113531
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113531
18 years, 3 months
[Design of POJO Server] - Re: Serialization, NoSuchMethodException in ProfileServiceUn
by alesj
Yes.
This is when you are trying to transform runtime type instance - which is generics unaware.
If you did something like this:
| public class MyClass
| {
| public byte[] someBytes();
| }
|
And then (pseudo) MyClass.getMethod("someBytes").getGenericReturnType().
Then it would fail.
In this code
| public T get(Type type)
| {
| if (type == null)
| throw new IllegalArgumentException("Null type");
|
| if (type instanceof ParameterizedType)
| return getParameterizedType((ParameterizedType) type);
| else if (type instanceof Class)
| return getClass((Class<?>) type);
| else if (type instanceof TypeVariable)
| // TODO Figure out why we need this cast with the Sun compiler?
| return (T) getTypeVariable((TypeVariable) type);
| else if (type instanceof GenericArrayType)
| return getGenericArrayType((GenericArrayType) type);
| else if (type instanceof WildcardType)
| return getWildcardType((WildcardType) type);
| else
| throw new UnsupportedOperationException("Unknown type: " + type + " class=" + type.getClass());
| }
|
The first example is picked up by (instance of Class), where the 2nd one is by the method I mentioned before.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113512#4113512
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113512
18 years, 3 months
[Design of POJO Server] - Re: Serialization, NoSuchMethodException in ProfileServiceUn
by alesj
You're right. :-(
This test shows it:
| public class Test
| {
| public static void main(String[] args)
| {
| try
| {
| Configuration configuration = new PropertyConfiguration();
| BeanInfo beanInfo = configuration.getBeanInfo(ClassLoader.class);
| Set<MethodInfo> methods = beanInfo.getMethods();
| for(MethodInfo mi : methods)
| {
| byte[] bytes = serialize((Serializable)mi);
| Object o = deserialize(bytes);
| System.out.println("o = " + o);
| }
| }
| catch (Exception e)
| {
| e.printStackTrace();
| }
| }
|
| protected static byte[] serialize(Serializable object) throws Exception
| {
| ByteArrayOutputStream baos = new ByteArrayOutputStream();
| ObjectOutputStream oos = new ObjectOutputStream(baos);
| oos.writeObject(object);
| oos.close();
| return baos.toByteArray();
| }
|
| protected static Object deserialize(byte[] bytes) throws Exception
| {
| ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
| ObjectInputStream ois = new ObjectInputStream(bais);
| return ois.readObject();
| }
| }
|
Any ideas?
I'll have a look at it.
Trying to fix it, and commit together with all the changes needed for Alexey.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113487#4113487
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113487
18 years, 3 months