Talip,
The queue full exception occurs after running several TestNG unit tests against the SEAM managed class defined below.
Can you tell me, in general, what are possible causes for a queue full exception? I suppose the answer is obvious and I may need to simply check to see how many items we are adding (though it should theoretically be a very small number - e.g 10-20) during unit test to see if we are somehow exceeding a reasonable number.
Thanks!
@Name("objectAccessor")
@Scope(ScopeType.APPLICATION)
@AutoCreate
@Startup
public class ObjectAccessor
{
public ObjectId create(ObjectId objectId, Object object)
{
if (objectMap.putIfAbsent(objectId, object) != null)
throw new Exception(objectId.toString());
return objectId;
}
public Object read(ObjectId objectId)
{
Object object = objectMap.get(objectId);
if (!objectMap.containsKey(objectId))
throw new Exception(objectId.toString());
return object;
}
public void update(ObjectId objectId, Object object)
{
if (objectMap.put(objectId, object) == null)
{
objectMap.remove(objectId);
throw new Exception(objectId.toString());
}
}
public void delete(ObjectId objectId)
{
if (objectMap.remove(objectId) == null)
throw new Exception(objectId.toString());
}
private ObjectId getObjectId(Object object)
{
return new ObjectId(((object instanceof CreateObject) ? "create-" : "update-")
+ idGenerator.newId());
}
@PostConstruct
public void postConstruct()
{
objectMap = Hazelcast.getMap("objects");
idGenerator = Hazelcast.getIdGenerator("object-ids");
}
@PreDestroy
public void preDestroy()
{
Hazelcast.shutdown();
}
private IMap<ObjectId, Object> objectMap = null;
private IdGenerator idGenerator = null;