id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,400 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/startup/ReflectionsTypeScanner.java | ReflectionsTypeScanner.removeAbstractTypes | private Collection<Class<? extends Saga>> removeAbstractTypes(final Collection<Class<? extends Saga>> foundTypes) {
Collection<Class<? extends Saga>> sagaTypes = new ArrayList<>();
for (Class<? extends Saga> entryType : foundTypes) {
if (!Modifier.isAbstract(entryType.getModifiers())) {
sagaTypes.add(entryType);
}
}
return sagaTypes;
} | java | private Collection<Class<? extends Saga>> removeAbstractTypes(final Collection<Class<? extends Saga>> foundTypes) {
Collection<Class<? extends Saga>> sagaTypes = new ArrayList<>();
for (Class<? extends Saga> entryType : foundTypes) {
if (!Modifier.isAbstract(entryType.getModifiers())) {
sagaTypes.add(entryType);
}
}
return sagaTypes;
} | [
"private",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"Saga",
">",
">",
"removeAbstractTypes",
"(",
"final",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"Saga",
">",
">",
"foundTypes",
")",
"{",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
... | Creates a new collection with abstract types which can not be instantiated. | [
"Creates",
"a",
"new",
"collection",
"with",
"abstract",
"types",
"which",
"can",
"not",
"be",
"instantiated",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/startup/ReflectionsTypeScanner.java#L74-L84 |
9,401 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java | RawDataBuffer.writeNullableUTF | public void writeNullableUTF(String str)
{
if (str == null)
write(NULL_VALUE);
else
{
write(NOT_NULL_VALUE);
writeUTF(str);
}
} | java | public void writeNullableUTF(String str)
{
if (str == null)
write(NULL_VALUE);
else
{
write(NOT_NULL_VALUE);
writeUTF(str);
}
} | [
"public",
"void",
"writeNullableUTF",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"write",
"(",
"NULL_VALUE",
")",
";",
"else",
"{",
"write",
"(",
"NOT_NULL_VALUE",
")",
";",
"writeUTF",
"(",
"str",
")",
";",
"}",
"}"
] | Write a string or null value to the stream | [
"Write",
"a",
"string",
"or",
"null",
"value",
"to",
"the",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java#L74-L83 |
9,402 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java | RawDataBuffer.ensureCapacity | public final void ensureCapacity( int targetCapacity )
{
if (targetCapacity > capacity)
{
int newLength = Math.max(capacity << 1, targetCapacity);
byte[] copy = new byte[newLength];
System.arraycopy(buf, 0, copy, 0, capacity);
buf = copy;
capacity = newLength;
}
} | java | public final void ensureCapacity( int targetCapacity )
{
if (targetCapacity > capacity)
{
int newLength = Math.max(capacity << 1, targetCapacity);
byte[] copy = new byte[newLength];
System.arraycopy(buf, 0, copy, 0, capacity);
buf = copy;
capacity = newLength;
}
} | [
"public",
"final",
"void",
"ensureCapacity",
"(",
"int",
"targetCapacity",
")",
"{",
"if",
"(",
"targetCapacity",
">",
"capacity",
")",
"{",
"int",
"newLength",
"=",
"Math",
".",
"max",
"(",
"capacity",
"<<",
"1",
",",
"targetCapacity",
")",
";",
"byte",
... | Ensure that the buffer internal capacity is at least targetCapacity
@param targetCapacity the expected capacity | [
"Ensure",
"that",
"the",
"buffer",
"internal",
"capacity",
"is",
"at",
"least",
"targetCapacity"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java#L89-L99 |
9,403 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java | RawDataBuffer.writeNullableByteArray | public void writeNullableByteArray( byte[] value )
{
if (value == null)
write(NULL_VALUE);
else
{
write(NOT_NULL_VALUE);
writeInt(value.length);
write(value);
}
} | java | public void writeNullableByteArray( byte[] value )
{
if (value == null)
write(NULL_VALUE);
else
{
write(NOT_NULL_VALUE);
writeInt(value.length);
write(value);
}
} | [
"public",
"void",
"writeNullableByteArray",
"(",
"byte",
"[",
"]",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"write",
"(",
"NULL_VALUE",
")",
";",
"else",
"{",
"write",
"(",
"NOT_NULL_VALUE",
")",
";",
"writeInt",
"(",
"value",
".",
"le... | Write a nullable byte array to the stream | [
"Write",
"a",
"nullable",
"byte",
"array",
"to",
"the",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java#L397-L407 |
9,404 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java | RawDataBuffer.writeGeneric | public void writeGeneric( Object value )
{
if (value == null)
write(NULL_VALUE);
else
{
if (value instanceof String)
{
writeByte(TYPE_STRING);
writeUTF((String)value);
}
else if (value instanceof Boolean)
{
writeByte(TYPE_BOOLEAN);
writeBoolean(((Boolean)value).booleanValue());
}
else if (value instanceof Byte)
{
writeByte(TYPE_BYTE);
writeByte(((Byte)value).byteValue());
}
else if (value instanceof Short)
{
writeByte(TYPE_SHORT);
writeShort(((Short)value).shortValue());
}
else if (value instanceof Integer)
{
writeByte(TYPE_INT);
writeInt(((Integer)value).intValue());
}
else if (value instanceof Long)
{
writeByte(TYPE_LONG);
writeLong(((Long)value).longValue());
}
else if (value instanceof Float)
{
writeByte(TYPE_FLOAT);
writeFloat(((Float)value).floatValue());
}
else if (value instanceof Double)
{
writeByte(TYPE_DOUBLE);
writeDouble(((Double)value).doubleValue());
}
else if (value instanceof byte[])
{
writeByte(TYPE_BYTEARRAY);
writeByteArray((byte[])value);
}
else if (value instanceof Character)
{
writeByte(TYPE_CHARACTER);
writeChar(((Character)value).charValue());
}
else
throw new IllegalArgumentException("Unsupported type : "+value.getClass().getName());
} | java | public void writeGeneric( Object value )
{
if (value == null)
write(NULL_VALUE);
else
{
if (value instanceof String)
{
writeByte(TYPE_STRING);
writeUTF((String)value);
}
else if (value instanceof Boolean)
{
writeByte(TYPE_BOOLEAN);
writeBoolean(((Boolean)value).booleanValue());
}
else if (value instanceof Byte)
{
writeByte(TYPE_BYTE);
writeByte(((Byte)value).byteValue());
}
else if (value instanceof Short)
{
writeByte(TYPE_SHORT);
writeShort(((Short)value).shortValue());
}
else if (value instanceof Integer)
{
writeByte(TYPE_INT);
writeInt(((Integer)value).intValue());
}
else if (value instanceof Long)
{
writeByte(TYPE_LONG);
writeLong(((Long)value).longValue());
}
else if (value instanceof Float)
{
writeByte(TYPE_FLOAT);
writeFloat(((Float)value).floatValue());
}
else if (value instanceof Double)
{
writeByte(TYPE_DOUBLE);
writeDouble(((Double)value).doubleValue());
}
else if (value instanceof byte[])
{
writeByte(TYPE_BYTEARRAY);
writeByteArray((byte[])value);
}
else if (value instanceof Character)
{
writeByte(TYPE_CHARACTER);
writeChar(((Character)value).charValue());
}
else
throw new IllegalArgumentException("Unsupported type : "+value.getClass().getName());
} | [
"public",
"void",
"writeGeneric",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"write",
"(",
"NULL_VALUE",
")",
";",
"else",
"{",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"writeByte",
"(",
"TYPE_STRING",
")",
";... | Write a generic type to the stream | [
"Write",
"a",
"generic",
"type",
"to",
"the",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/RawDataBuffer.java#L421-L479 |
9,405 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/startup/MessageHandler.java | MessageHandler.reflectionInvokedHandler | public static MessageHandler reflectionInvokedHandler(final Class<?> messageType, final Method methodToInvoke, final boolean startsSaga) {
return new MessageHandler(messageType, methodToInvoke, startsSaga);
} | java | public static MessageHandler reflectionInvokedHandler(final Class<?> messageType, final Method methodToInvoke, final boolean startsSaga) {
return new MessageHandler(messageType, methodToInvoke, startsSaga);
} | [
"public",
"static",
"MessageHandler",
"reflectionInvokedHandler",
"(",
"final",
"Class",
"<",
"?",
">",
"messageType",
",",
"final",
"Method",
"methodToInvoke",
",",
"final",
"boolean",
"startsSaga",
")",
"{",
"return",
"new",
"MessageHandler",
"(",
"messageType",
... | Creates new handler, with the reflection information about the method to call. | [
"Creates",
"new",
"handler",
"with",
"the",
"reflection",
"information",
"about",
"the",
"method",
"to",
"call",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/startup/MessageHandler.java#L70-L72 |
9,406 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/timeout/InMemoryTimeoutManager.java | InMemoryTimeoutManager.timeoutExpired | private void timeoutExpired(final Timeout timeout, final TimeoutContext context) {
try {
removeExpiredTimeout(timeout);
for (TimeoutExpired callback : callbacks) {
if (callback instanceof TimeoutExpirationCallback) {
((TimeoutExpirationCallback) callback).expired(timeout, context);
} else {
callback.expired(timeout);
}
}
} catch (Exception ex) {
// catch all exceptions. otherwise calling timeout thread of timers thread pool will be terminated.
LOG.error("Error handling timeout.", ex);
}
} | java | private void timeoutExpired(final Timeout timeout, final TimeoutContext context) {
try {
removeExpiredTimeout(timeout);
for (TimeoutExpired callback : callbacks) {
if (callback instanceof TimeoutExpirationCallback) {
((TimeoutExpirationCallback) callback).expired(timeout, context);
} else {
callback.expired(timeout);
}
}
} catch (Exception ex) {
// catch all exceptions. otherwise calling timeout thread of timers thread pool will be terminated.
LOG.error("Error handling timeout.", ex);
}
} | [
"private",
"void",
"timeoutExpired",
"(",
"final",
"Timeout",
"timeout",
",",
"final",
"TimeoutContext",
"context",
")",
"{",
"try",
"{",
"removeExpiredTimeout",
"(",
"timeout",
")",
";",
"for",
"(",
"TimeoutExpired",
"callback",
":",
"callbacks",
")",
"{",
"i... | Called by timeout task once timeout has expired. | [
"Called",
"by",
"timeout",
"task",
"once",
"timeout",
"has",
"expired",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/timeout/InMemoryTimeoutManager.java#L154-L169 |
9,407 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/session/AbstractQueueBrowser.java | AbstractQueueBrowser.closeRemainingEnumerations | private void closeRemainingEnumerations()
{
List<AbstractQueueBrowserEnumeration> enumsToClose = new Vector<>();
synchronized (enumMap)
{
enumsToClose.addAll(enumMap.values());
for (int n = 0 ; n < enumsToClose.size() ; n++)
{
AbstractQueueBrowserEnumeration queueBrowserEnum = enumsToClose.get(n);
log.debug("Auto-closing unclosed queue browser enumeration : "+queueBrowserEnum);
try
{
queueBrowserEnum.close();
}
catch (Exception e)
{
log.error("Could not close queue browser enumeration "+queueBrowserEnum,e);
}
}
}
} | java | private void closeRemainingEnumerations()
{
List<AbstractQueueBrowserEnumeration> enumsToClose = new Vector<>();
synchronized (enumMap)
{
enumsToClose.addAll(enumMap.values());
for (int n = 0 ; n < enumsToClose.size() ; n++)
{
AbstractQueueBrowserEnumeration queueBrowserEnum = enumsToClose.get(n);
log.debug("Auto-closing unclosed queue browser enumeration : "+queueBrowserEnum);
try
{
queueBrowserEnum.close();
}
catch (Exception e)
{
log.error("Could not close queue browser enumeration "+queueBrowserEnum,e);
}
}
}
} | [
"private",
"void",
"closeRemainingEnumerations",
"(",
")",
"{",
"List",
"<",
"AbstractQueueBrowserEnumeration",
">",
"enumsToClose",
"=",
"new",
"Vector",
"<>",
"(",
")",
";",
"synchronized",
"(",
"enumMap",
")",
"{",
"enumsToClose",
".",
"addAll",
"(",
"enumMap... | Close remaining browser enumerations | [
"Close",
"remaining",
"browser",
"enumerations"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/session/AbstractQueueBrowser.java#L106-L126 |
9,408 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationSerializer.java | DestinationSerializer.serializeTo | public static void serializeTo( Destination destination , RawDataBuffer out )
{
try
{
if (destination == null)
{
out.writeByte(NO_DESTINATION);
}
else
if (destination instanceof Queue)
{
out.writeByte(TYPE_QUEUE);
out.writeUTF(((Queue)destination).getQueueName());
}
else
if (destination instanceof Topic)
{
out.writeByte(TYPE_TOPIC);
out.writeUTF(((Topic)destination).getTopicName());
}
else
throw new IllegalArgumentException("Unsupported destination : "+destination);
}
catch (JMSException e)
{
throw new IllegalArgumentException("Cannot serialize destination : "+e.getMessage());
}
} | java | public static void serializeTo( Destination destination , RawDataBuffer out )
{
try
{
if (destination == null)
{
out.writeByte(NO_DESTINATION);
}
else
if (destination instanceof Queue)
{
out.writeByte(TYPE_QUEUE);
out.writeUTF(((Queue)destination).getQueueName());
}
else
if (destination instanceof Topic)
{
out.writeByte(TYPE_TOPIC);
out.writeUTF(((Topic)destination).getTopicName());
}
else
throw new IllegalArgumentException("Unsupported destination : "+destination);
}
catch (JMSException e)
{
throw new IllegalArgumentException("Cannot serialize destination : "+e.getMessage());
}
} | [
"public",
"static",
"void",
"serializeTo",
"(",
"Destination",
"destination",
",",
"RawDataBuffer",
"out",
")",
"{",
"try",
"{",
"if",
"(",
"destination",
"==",
"null",
")",
"{",
"out",
".",
"writeByte",
"(",
"NO_DESTINATION",
")",
";",
"}",
"else",
"if",
... | Serialize a destination to the given stream | [
"Serialize",
"a",
"destination",
"to",
"the",
"given",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationSerializer.java#L42-L69 |
9,409 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationSerializer.java | DestinationSerializer.unserializeFrom | public static DestinationRef unserializeFrom( RawDataBuffer in )
{
int type = in.readByte();
if (type == NO_DESTINATION)
return null;
String destinationName = in.readUTF();
switch (type)
{
case TYPE_QUEUE : return new QueueRef(destinationName);
case TYPE_TOPIC : return new TopicRef(destinationName);
default:
throw new IllegalArgumentException("Unsupported destination type : "+type);
}
} | java | public static DestinationRef unserializeFrom( RawDataBuffer in )
{
int type = in.readByte();
if (type == NO_DESTINATION)
return null;
String destinationName = in.readUTF();
switch (type)
{
case TYPE_QUEUE : return new QueueRef(destinationName);
case TYPE_TOPIC : return new TopicRef(destinationName);
default:
throw new IllegalArgumentException("Unsupported destination type : "+type);
}
} | [
"public",
"static",
"DestinationRef",
"unserializeFrom",
"(",
"RawDataBuffer",
"in",
")",
"{",
"int",
"type",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"type",
"==",
"NO_DESTINATION",
")",
"return",
"null",
";",
"String",
"destinationName",
"=",
... | Unserialize a destination from the given stream | [
"Unserialize",
"a",
"destination",
"from",
"the",
"given",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/destination/DestinationSerializer.java#L74-L88 |
9,410 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/TimeoutResolveStrategy.java | TimeoutResolveStrategy.prepareTypesList | private Collection<SagaType> prepareTypesList() {
Collection<SagaType> sagaTypes = new ArrayList<>();
// search for other sagas started by timeouts
Collection<SagaType> sagasToExecute = typesForMessageMapper.getSagasForMessageType(Timeout.class);
for (SagaType type : sagasToExecute) {
if (type.isStartingNewSaga()) {
sagaTypes.add(type);
}
}
return sagaTypes;
} | java | private Collection<SagaType> prepareTypesList() {
Collection<SagaType> sagaTypes = new ArrayList<>();
// search for other sagas started by timeouts
Collection<SagaType> sagasToExecute = typesForMessageMapper.getSagasForMessageType(Timeout.class);
for (SagaType type : sagasToExecute) {
if (type.isStartingNewSaga()) {
sagaTypes.add(type);
}
}
return sagaTypes;
} | [
"private",
"Collection",
"<",
"SagaType",
">",
"prepareTypesList",
"(",
")",
"{",
"Collection",
"<",
"SagaType",
">",
"sagaTypes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// search for other sagas started by timeouts",
"Collection",
"<",
"SagaType",
">",
"s... | Timeouts are special. They do not need an instance key to be found. However
there may be other starting sagas that want to handle timeouts of other saga instances. | [
"Timeouts",
"are",
"special",
".",
"They",
"do",
"not",
"need",
"an",
"instance",
"key",
"to",
"be",
"found",
".",
"However",
"there",
"may",
"be",
"other",
"starting",
"sagas",
"that",
"want",
"to",
"handle",
"timeouts",
"of",
"other",
"saga",
"instances"... | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/TimeoutResolveStrategy.java#L92-L104 |
9,411 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/transport/tcp/nio/NIOTcpMultiplexer.java | NIOTcpMultiplexer.unregisterServerSocketHandler | public void unregisterServerSocketHandler( NIOServerSocketHandler serverHandler )
{
if (pendingAcceptHandlers.remove(serverHandler))
return; // Not handled yet
if (serverHandlers.remove(serverHandler))
{
closeSocketChannel(serverHandler.getServerSocketChannel(), selector);
wakeUpAndWait();
}
} | java | public void unregisterServerSocketHandler( NIOServerSocketHandler serverHandler )
{
if (pendingAcceptHandlers.remove(serverHandler))
return; // Not handled yet
if (serverHandlers.remove(serverHandler))
{
closeSocketChannel(serverHandler.getServerSocketChannel(), selector);
wakeUpAndWait();
}
} | [
"public",
"void",
"unregisterServerSocketHandler",
"(",
"NIOServerSocketHandler",
"serverHandler",
")",
"{",
"if",
"(",
"pendingAcceptHandlers",
".",
"remove",
"(",
"serverHandler",
")",
")",
"return",
";",
"// Not handled yet",
"if",
"(",
"serverHandlers",
".",
"remo... | Unregister a new server socket handler | [
"Unregister",
"a",
"new",
"server",
"socket",
"handler"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/transport/tcp/nio/NIOTcpMultiplexer.java#L144-L154 |
9,412 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/AbstractBlockBasedDataStore.java | AbstractBlockBasedDataStore.serializeAllocationBlock | protected final byte[] serializeAllocationBlock( int blockIndex )
{
byte[] allocationBlock = new byte[AT_BLOCK_SIZE];
// Regroup I/O to improve performance
allocationBlock[AB_FLAGS_OFFSET] = flags[blockIndex];
allocationBlock[AB_ALLOCSIZE_OFFSET] = (byte)((allocatedSize[blockIndex] >>> 24) & 0xFF);
allocationBlock[AB_ALLOCSIZE_OFFSET+1] = (byte)((allocatedSize[blockIndex] >>> 16) & 0xFF);
allocationBlock[AB_ALLOCSIZE_OFFSET+2] = (byte)((allocatedSize[blockIndex] >>> 8) & 0xFF);
allocationBlock[AB_ALLOCSIZE_OFFSET+3] = (byte)((allocatedSize[blockIndex] >>> 0) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET] = (byte)((previousBlock[blockIndex] >>> 24) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET+1] = (byte)((previousBlock[blockIndex] >>> 16) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET+2] = (byte)((previousBlock[blockIndex] >>> 8) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET+3] = (byte)((previousBlock[blockIndex] >>> 0) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET] = (byte)((nextBlock[blockIndex] >>> 24) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET+1] = (byte)((nextBlock[blockIndex] >>> 16) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET+2] = (byte)((nextBlock[blockIndex] >>> 8) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET+3] = (byte)((nextBlock[blockIndex] >>> 0) & 0xFF);
return allocationBlock;
} | java | protected final byte[] serializeAllocationBlock( int blockIndex )
{
byte[] allocationBlock = new byte[AT_BLOCK_SIZE];
// Regroup I/O to improve performance
allocationBlock[AB_FLAGS_OFFSET] = flags[blockIndex];
allocationBlock[AB_ALLOCSIZE_OFFSET] = (byte)((allocatedSize[blockIndex] >>> 24) & 0xFF);
allocationBlock[AB_ALLOCSIZE_OFFSET+1] = (byte)((allocatedSize[blockIndex] >>> 16) & 0xFF);
allocationBlock[AB_ALLOCSIZE_OFFSET+2] = (byte)((allocatedSize[blockIndex] >>> 8) & 0xFF);
allocationBlock[AB_ALLOCSIZE_OFFSET+3] = (byte)((allocatedSize[blockIndex] >>> 0) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET] = (byte)((previousBlock[blockIndex] >>> 24) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET+1] = (byte)((previousBlock[blockIndex] >>> 16) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET+2] = (byte)((previousBlock[blockIndex] >>> 8) & 0xFF);
allocationBlock[AB_PREVBLOCK_OFFSET+3] = (byte)((previousBlock[blockIndex] >>> 0) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET] = (byte)((nextBlock[blockIndex] >>> 24) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET+1] = (byte)((nextBlock[blockIndex] >>> 16) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET+2] = (byte)((nextBlock[blockIndex] >>> 8) & 0xFF);
allocationBlock[AB_NEXTBLOCK_OFFSET+3] = (byte)((nextBlock[blockIndex] >>> 0) & 0xFF);
return allocationBlock;
} | [
"protected",
"final",
"byte",
"[",
"]",
"serializeAllocationBlock",
"(",
"int",
"blockIndex",
")",
"{",
"byte",
"[",
"]",
"allocationBlock",
"=",
"new",
"byte",
"[",
"AT_BLOCK_SIZE",
"]",
";",
"// Regroup I/O to improve performance",
"allocationBlock",
"[",
"AB_FLAG... | Serialize allocation block at index blockIndex
@param blockIndex the block index
@return the serialized allocation block | [
"Serialize",
"allocation",
"block",
"at",
"index",
"blockIndex"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/AbstractBlockBasedDataStore.java#L1084-L1104 |
9,413 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/timeout/SagaTimeoutTask.java | SagaTimeoutTask.run | @Override
public void run() {
Timeout timeout = Timeout.create(timeoutId, sagaId, name, clock.now(), data);
expiredCallback.expired(timeout);
} | java | @Override
public void run() {
Timeout timeout = Timeout.create(timeoutId, sagaId, name, clock.now(), data);
expiredCallback.expired(timeout);
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"Timeout",
"timeout",
"=",
"Timeout",
".",
"create",
"(",
"timeoutId",
",",
"sagaId",
",",
"name",
",",
"clock",
".",
"now",
"(",
")",
",",
"data",
")",
";",
"expiredCallback",
".",
"expired",
... | Called by timer as timeout expires. | [
"Called",
"by",
"timer",
"as",
"timeout",
"expires",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/timeout/SagaTimeoutTask.java#L50-L54 |
9,414 | timewalker74/ffmq | server/src/main/java/net/timewalker/ffmq4/admin/RemoteAdministrationThread.java | RemoteAdministrationThread.pleaseStop | public void pleaseStop()
{
if (stopRequired)
return;
stopRequired = true;
try
{
if (receiver != null)
receiver.close();
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
} | java | public void pleaseStop()
{
if (stopRequired)
return;
stopRequired = true;
try
{
if (receiver != null)
receiver.close();
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
} | [
"public",
"void",
"pleaseStop",
"(",
")",
"{",
"if",
"(",
"stopRequired",
")",
"return",
";",
"stopRequired",
"=",
"true",
";",
"try",
"{",
"if",
"(",
"receiver",
"!=",
"null",
")",
"receiver",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JMSExce... | Ask the thread to stop | [
"Ask",
"the",
"thread",
"to",
"stop"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/server/src/main/java/net/timewalker/ffmq4/admin/RemoteAdministrationThread.java#L329-L344 |
9,415 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/ArrayTools.java | ArrayTools.copy | public static byte[] copy( byte[] array )
{
byte[] result = new byte[array.length];
System.arraycopy(array, 0, result, 0, array.length);
return result;
} | java | public static byte[] copy( byte[] array )
{
byte[] result = new byte[array.length];
System.arraycopy(array, 0, result, 0, array.length);
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"copy",
"(",
"byte",
"[",
"]",
"array",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"array",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"0",
",",
"result",
",",... | Copy a byte array
@param array the original array
@return an array copy | [
"Copy",
"a",
"byte",
"array"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/ArrayTools.java#L31-L36 |
9,416 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java | AbstractMessage.copyCommonFields | protected final void copyCommonFields( AbstractMessage clone )
{
clone.id = this.id;
clone.correlId = this.correlId;
clone.priority = this.priority;
clone.deliveryMode = this.deliveryMode;
clone.destination = this.destination;
clone.expiration = this.expiration;
clone.redelivered = this.redelivered;
clone.replyTo = this.replyTo;
clone.timestamp = this.timestamp;
clone.type = this.type;
@SuppressWarnings("unchecked")
Map<String,Object> propertyMapClone = this.propertyMap != null ? (Map<String,Object>)((HashMap<String,Object>)this.propertyMap).clone() : null;
clone.propertyMap = propertyMapClone;
// Copy raw message cache if any
clone.unserializationLevel = this.unserializationLevel;
if (this.rawMessage != null)
clone.rawMessage = this.rawMessage.copy();
} | java | protected final void copyCommonFields( AbstractMessage clone )
{
clone.id = this.id;
clone.correlId = this.correlId;
clone.priority = this.priority;
clone.deliveryMode = this.deliveryMode;
clone.destination = this.destination;
clone.expiration = this.expiration;
clone.redelivered = this.redelivered;
clone.replyTo = this.replyTo;
clone.timestamp = this.timestamp;
clone.type = this.type;
@SuppressWarnings("unchecked")
Map<String,Object> propertyMapClone = this.propertyMap != null ? (Map<String,Object>)((HashMap<String,Object>)this.propertyMap).clone() : null;
clone.propertyMap = propertyMapClone;
// Copy raw message cache if any
clone.unserializationLevel = this.unserializationLevel;
if (this.rawMessage != null)
clone.rawMessage = this.rawMessage.copy();
} | [
"protected",
"final",
"void",
"copyCommonFields",
"(",
"AbstractMessage",
"clone",
")",
"{",
"clone",
".",
"id",
"=",
"this",
".",
"id",
";",
"clone",
".",
"correlId",
"=",
"this",
".",
"correlId",
";",
"clone",
".",
"priority",
"=",
"this",
".",
"priori... | Create an independant copy of this message | [
"Create",
"an",
"independant",
"copy",
"of",
"this",
"message"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java#L96-L117 |
9,417 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java | AbstractMessage.setSession | public final void setSession( AbstractSession session ) throws JMSException
{
if (session == null)
this.sessionRef = null;
else
{
// Consistency check
if (sessionRef != null && sessionRef.get() != session)
throw new FFMQException("Message session already set","CONSISTENCY");
this.sessionRef = new WeakReference<>(session);
}
} | java | public final void setSession( AbstractSession session ) throws JMSException
{
if (session == null)
this.sessionRef = null;
else
{
// Consistency check
if (sessionRef != null && sessionRef.get() != session)
throw new FFMQException("Message session already set","CONSISTENCY");
this.sessionRef = new WeakReference<>(session);
}
} | [
"public",
"final",
"void",
"setSession",
"(",
"AbstractSession",
"session",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"session",
"==",
"null",
")",
"this",
".",
"sessionRef",
"=",
"null",
";",
"else",
"{",
"// Consistency check",
"if",
"(",
"sessionRef",
... | Set the message session | [
"Set",
"the",
"message",
"session"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java#L122-L134 |
9,418 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java | AbstractMessage.getSession | protected final AbstractSession getSession() throws JMSException
{
if (sessionRef == null)
throw new FFMQException("Message has no associated session","CONSISTENCY");
AbstractSession session = sessionRef.get();
if (session == null)
throw new FFMQException("Message session is no longer valid","CONSISTENCY");
return session;
} | java | protected final AbstractSession getSession() throws JMSException
{
if (sessionRef == null)
throw new FFMQException("Message has no associated session","CONSISTENCY");
AbstractSession session = sessionRef.get();
if (session == null)
throw new FFMQException("Message session is no longer valid","CONSISTENCY");
return session;
} | [
"protected",
"final",
"AbstractSession",
"getSession",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"sessionRef",
"==",
"null",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Message has no associated session\"",
",",
"\"CONSISTENCY\"",
")",
";",
"AbstractSessio... | Get the parent session | [
"Get",
"the",
"parent",
"session"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java#L139-L149 |
9,419 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java | AbstractMessage.serializeTo | protected final void serializeTo( RawDataBuffer out )
{
// Level 1 - Always unserialized
byte lvl1Flags = (byte)((priority & 0x0F)+
(redelivered ? (1 << 4) : 0)+
(deliveryMode == DeliveryMode.PERSISTENT ? (1 << 5) : 0)+
(expiration != 0 ? (1 << 6) : 0)+ // Expiration value present
(id != null ? (1 << 7) : 0)); // ID value present
out.writeByte(lvl1Flags);
if (expiration != 0)
out.writeLong(expiration);
if (id != null)
out.writeUTF(id);
DestinationSerializer.serializeTo(destination, out);
// Level 2 - Unserialized if required by a message selector
byte lvl2Flags = (byte)((correlId != null ? (1 << 0) : 0)+
(replyTo != null ? (1 << 1) : 0)+
(timestamp != 0 ? (1 << 2) : 0)+
(type != null ? (1 << 3) : 0)+
(propertyMap != null && !propertyMap.isEmpty() ? (1 << 4) : 0));
out.writeByte(lvl2Flags);
if (correlId != null)
out.writeUTF(correlId);
if (replyTo != null)
DestinationSerializer.serializeTo(replyTo, out);
if (timestamp != 0)
out.writeLong(timestamp);
if (type != null)
out.writeUTF(type);
if (propertyMap != null && !propertyMap.isEmpty())
writeMapTo(propertyMap, out);
// Level 3 - Body - Only unserialized on the client side
serializeBodyTo(out);
} | java | protected final void serializeTo( RawDataBuffer out )
{
// Level 1 - Always unserialized
byte lvl1Flags = (byte)((priority & 0x0F)+
(redelivered ? (1 << 4) : 0)+
(deliveryMode == DeliveryMode.PERSISTENT ? (1 << 5) : 0)+
(expiration != 0 ? (1 << 6) : 0)+ // Expiration value present
(id != null ? (1 << 7) : 0)); // ID value present
out.writeByte(lvl1Flags);
if (expiration != 0)
out.writeLong(expiration);
if (id != null)
out.writeUTF(id);
DestinationSerializer.serializeTo(destination, out);
// Level 2 - Unserialized if required by a message selector
byte lvl2Flags = (byte)((correlId != null ? (1 << 0) : 0)+
(replyTo != null ? (1 << 1) : 0)+
(timestamp != 0 ? (1 << 2) : 0)+
(type != null ? (1 << 3) : 0)+
(propertyMap != null && !propertyMap.isEmpty() ? (1 << 4) : 0));
out.writeByte(lvl2Flags);
if (correlId != null)
out.writeUTF(correlId);
if (replyTo != null)
DestinationSerializer.serializeTo(replyTo, out);
if (timestamp != 0)
out.writeLong(timestamp);
if (type != null)
out.writeUTF(type);
if (propertyMap != null && !propertyMap.isEmpty())
writeMapTo(propertyMap, out);
// Level 3 - Body - Only unserialized on the client side
serializeBodyTo(out);
} | [
"protected",
"final",
"void",
"serializeTo",
"(",
"RawDataBuffer",
"out",
")",
"{",
"// Level 1 - Always unserialized",
"byte",
"lvl1Flags",
"=",
"(",
"byte",
")",
"(",
"(",
"priority",
"&",
"0x0F",
")",
"+",
"(",
"redelivered",
"?",
"(",
"1",
"<<",
"4",
"... | Write the message content to the given output stream | [
"Write",
"the",
"message",
"content",
"to",
"the",
"given",
"output",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java#L655-L690 |
9,420 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java | AbstractMessage.initializeFromRaw | protected final void initializeFromRaw( RawDataBuffer rawMessage )
{
this.rawMessage = rawMessage;
this.unserializationLevel = MessageSerializationLevel.BASE_HEADERS;
// Only deserialize level 1 headers
byte lvl1Flags = rawMessage.readByte();
priority = lvl1Flags & 0x0F;
redelivered = (lvl1Flags & (1 << 4)) != 0;
deliveryMode = (lvl1Flags & (1 << 5)) != 0 ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
if ((lvl1Flags & (1 << 6)) != 0) expiration = rawMessage.readLong();
if ((lvl1Flags & (1 << 7)) != 0) id = rawMessage.readUTF();
destination = DestinationSerializer.unserializeFrom(rawMessage);
} | java | protected final void initializeFromRaw( RawDataBuffer rawMessage )
{
this.rawMessage = rawMessage;
this.unserializationLevel = MessageSerializationLevel.BASE_HEADERS;
// Only deserialize level 1 headers
byte lvl1Flags = rawMessage.readByte();
priority = lvl1Flags & 0x0F;
redelivered = (lvl1Flags & (1 << 4)) != 0;
deliveryMode = (lvl1Flags & (1 << 5)) != 0 ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
if ((lvl1Flags & (1 << 6)) != 0) expiration = rawMessage.readLong();
if ((lvl1Flags & (1 << 7)) != 0) id = rawMessage.readUTF();
destination = DestinationSerializer.unserializeFrom(rawMessage);
} | [
"protected",
"final",
"void",
"initializeFromRaw",
"(",
"RawDataBuffer",
"rawMessage",
")",
"{",
"this",
".",
"rawMessage",
"=",
"rawMessage",
";",
"this",
".",
"unserializationLevel",
"=",
"MessageSerializationLevel",
".",
"BASE_HEADERS",
";",
"// Only deserialize leve... | Initialize the message from the given raw data | [
"Initialize",
"the",
"message",
"from",
"the",
"given",
"raw",
"data"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/AbstractMessage.java#L695-L708 |
9,421 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/ErrorTools.java | ErrorTools.log | public static void log( String context , JMSException e , Log log )
{
StringBuilder message = new StringBuilder();
if (context != null)
{
message.append("[");
message.append(context);
message.append("] ");
}
if (e.getErrorCode() != null)
{
message.append("error={");
message.append(e.getErrorCode());
message.append("} ");
}
message.append(e.getMessage());
log.error(message.toString());
if (e.getLinkedException() != null)
log.error("Linked exception was :",e.getLinkedException());
} | java | public static void log( String context , JMSException e , Log log )
{
StringBuilder message = new StringBuilder();
if (context != null)
{
message.append("[");
message.append(context);
message.append("] ");
}
if (e.getErrorCode() != null)
{
message.append("error={");
message.append(e.getErrorCode());
message.append("} ");
}
message.append(e.getMessage());
log.error(message.toString());
if (e.getLinkedException() != null)
log.error("Linked exception was :",e.getLinkedException());
} | [
"public",
"static",
"void",
"log",
"(",
"String",
"context",
",",
"JMSException",
"e",
",",
"Log",
"log",
")",
"{",
"StringBuilder",
"message",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"message",
".",
"a... | Log a JMS exception with an error level
@param e
@param log | [
"Log",
"a",
"JMS",
"exception",
"with",
"an",
"error",
"level"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/ErrorTools.java#L44-L63 |
9,422 | Domo42/saga-lib | saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/FirstSagaToHandle.java | FirstSagaToHandle.firstExecute | public NextSagaToHandle firstExecute(final Class<? extends Saga> first) {
orderedTypes.add(0, first);
return new NextSagaToHandle(orderedTypes, builder);
} | java | public NextSagaToHandle firstExecute(final Class<? extends Saga> first) {
orderedTypes.add(0, first);
return new NextSagaToHandle(orderedTypes, builder);
} | [
"public",
"NextSagaToHandle",
"firstExecute",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"first",
")",
"{",
"orderedTypes",
".",
"add",
"(",
"0",
",",
"first",
")",
";",
"return",
"new",
"NextSagaToHandle",
"(",
"orderedTypes",
",",
"builder",
... | Define the first saga type to execute in case a message matches multiple ones. | [
"Define",
"the",
"first",
"saga",
"type",
"to",
"execute",
"in",
"case",
"a",
"message",
"matches",
"multiple",
"ones",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/FirstSagaToHandle.java#L41-L44 |
9,423 | Domo42/saga-lib | saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/SagaModuleBuilder.java | SagaModuleBuilder.build | public Module build() {
SagaLibModule module = new SagaLibModule();
module.setStateStorage(stateStorage);
module.setTimeoutManager(timeoutMgr);
module.setScanner(scanner);
module.setProviderFactory(providerFactory);
module.setExecutionOrder(preferredOrder);
module.setExecutionContext(executionContext);
module.setModuleTypes(moduleTypes);
module.setExecutor(executor);
module.setInterceptorTypes(interceptorTypes);
module.setStrategyFinder(strategyFinder);
module.setInvoker(invoker);
module.setCoordinatorFactory(coordinatorFactory);
return module;
} | java | public Module build() {
SagaLibModule module = new SagaLibModule();
module.setStateStorage(stateStorage);
module.setTimeoutManager(timeoutMgr);
module.setScanner(scanner);
module.setProviderFactory(providerFactory);
module.setExecutionOrder(preferredOrder);
module.setExecutionContext(executionContext);
module.setModuleTypes(moduleTypes);
module.setExecutor(executor);
module.setInterceptorTypes(interceptorTypes);
module.setStrategyFinder(strategyFinder);
module.setInvoker(invoker);
module.setCoordinatorFactory(coordinatorFactory);
return module;
} | [
"public",
"Module",
"build",
"(",
")",
"{",
"SagaLibModule",
"module",
"=",
"new",
"SagaLibModule",
"(",
")",
";",
"module",
".",
"setStateStorage",
"(",
"stateStorage",
")",
";",
"module",
".",
"setTimeoutManager",
"(",
"timeoutMgr",
")",
";",
"module",
"."... | Creates the module containing all saga lib bindings. | [
"Creates",
"the",
"module",
"containing",
"all",
"saga",
"lib",
"bindings",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/SagaModuleBuilder.java#L304-L320 |
9,424 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaTypeCacheLoader.java | SagaTypeCacheLoader.allMessageTypes | private Iterable<Class<?>> allMessageTypes(final Class<?> concreteMsgClass) {
ClassTypeExtractor extractor = new ClassTypeExtractor(concreteMsgClass);
return extractor.allClassesAndInterfaces();
} | java | private Iterable<Class<?>> allMessageTypes(final Class<?> concreteMsgClass) {
ClassTypeExtractor extractor = new ClassTypeExtractor(concreteMsgClass);
return extractor.allClassesAndInterfaces();
} | [
"private",
"Iterable",
"<",
"Class",
"<",
"?",
">",
">",
"allMessageTypes",
"(",
"final",
"Class",
"<",
"?",
">",
"concreteMsgClass",
")",
"{",
"ClassTypeExtractor",
"extractor",
"=",
"new",
"ClassTypeExtractor",
"(",
"concreteMsgClass",
")",
";",
"return",
"e... | Creates a list of types the concrete class may have handler matches. Like the
implemented interfaces of base classes. | [
"Creates",
"a",
"list",
"of",
"types",
"the",
"concrete",
"class",
"may",
"have",
"handler",
"matches",
".",
"Like",
"the",
"implemented",
"interfaces",
"of",
"base",
"classes",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaTypeCacheLoader.java#L112-L115 |
9,425 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaTypeCacheLoader.java | SagaTypeCacheLoader.containsItem | private SagaType containsItem(final Iterable<SagaType> source, final Class itemToSearch) {
SagaType containedItem = null;
for (SagaType sagaType : source) {
if (sagaType.getSagaClass().equals(itemToSearch)) {
containedItem = sagaType;
break;
}
}
return containedItem;
} | java | private SagaType containsItem(final Iterable<SagaType> source, final Class itemToSearch) {
SagaType containedItem = null;
for (SagaType sagaType : source) {
if (sagaType.getSagaClass().equals(itemToSearch)) {
containedItem = sagaType;
break;
}
}
return containedItem;
} | [
"private",
"SagaType",
"containsItem",
"(",
"final",
"Iterable",
"<",
"SagaType",
">",
"source",
",",
"final",
"Class",
"itemToSearch",
")",
"{",
"SagaType",
"containedItem",
"=",
"null",
";",
"for",
"(",
"SagaType",
"sagaType",
":",
"source",
")",
"{",
"if"... | Checks whether the source list contains a saga type matching the input class. | [
"Checks",
"whether",
"the",
"source",
"list",
"contains",
"a",
"saga",
"type",
"matching",
"the",
"input",
"class",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaTypeCacheLoader.java#L120-L131 |
9,426 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/watchdog/ActivityWatchdog.java | ActivityWatchdog.unregister | public void unregister( ActiveObject object )
{
synchronized (watchList)
{
for (int i = 0; i < watchList.size(); i++)
{
WeakReference<ActiveObject> weakRef = watchList.get(i);
ActiveObject obj = weakRef.get();
if (obj == null)
{
// Object was garbage collected, remove and continue
watchList.remove(i--);
continue;
}
if (obj == object)
{
// Found it !
watchList.remove(i);
break;
}
}
}
} | java | public void unregister( ActiveObject object )
{
synchronized (watchList)
{
for (int i = 0; i < watchList.size(); i++)
{
WeakReference<ActiveObject> weakRef = watchList.get(i);
ActiveObject obj = weakRef.get();
if (obj == null)
{
// Object was garbage collected, remove and continue
watchList.remove(i--);
continue;
}
if (obj == object)
{
// Found it !
watchList.remove(i);
break;
}
}
}
} | [
"public",
"void",
"unregister",
"(",
"ActiveObject",
"object",
")",
"{",
"synchronized",
"(",
"watchList",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"watchList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"WeakReference",
"<",
... | Unregister a monitored active object
@param object the object to unregister | [
"Unregister",
"a",
"monitored",
"active",
"object"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/watchdog/ActivityWatchdog.java#L191-L214 |
9,427 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/security/SecurityConnectorProvider.java | SecurityConnectorProvider.getConnector | public static synchronized SecurityConnector getConnector( FFMQEngineSetup setup ) throws JMSException
{
if (connector == null)
{
String connectorType = setup.getSecurityConnectorType();
try
{
Class<?> connectorClass = Class.forName(connectorType);
connector = (SecurityConnector)connectorClass
.getConstructor(new Class[] { Settings.class })
.newInstance(new Object[] { setup.getSettings() });
}
catch (ClassNotFoundException e)
{
throw new FFMQException("Security connector class not found : "+connectorType,"SECURITY_ERROR",e);
}
catch (ClassCastException e)
{
throw new FFMQException("Invalid security connector class : "+connectorType,"SECURITY_ERROR",e);
}
catch (InstantiationException e)
{
throw new FFMQException("Cannot create security connector","SECURITY_ERROR",e.getCause());
}
catch (InvocationTargetException e)
{
throw new FFMQException("Cannot create security connector","SECURITY_ERROR",e.getTargetException());
}
catch (Exception e)
{
throw new FFMQException("Cannot create security connector","SECURITY_ERROR",e);
}
}
return connector;
} | java | public static synchronized SecurityConnector getConnector( FFMQEngineSetup setup ) throws JMSException
{
if (connector == null)
{
String connectorType = setup.getSecurityConnectorType();
try
{
Class<?> connectorClass = Class.forName(connectorType);
connector = (SecurityConnector)connectorClass
.getConstructor(new Class[] { Settings.class })
.newInstance(new Object[] { setup.getSettings() });
}
catch (ClassNotFoundException e)
{
throw new FFMQException("Security connector class not found : "+connectorType,"SECURITY_ERROR",e);
}
catch (ClassCastException e)
{
throw new FFMQException("Invalid security connector class : "+connectorType,"SECURITY_ERROR",e);
}
catch (InstantiationException e)
{
throw new FFMQException("Cannot create security connector","SECURITY_ERROR",e.getCause());
}
catch (InvocationTargetException e)
{
throw new FFMQException("Cannot create security connector","SECURITY_ERROR",e.getTargetException());
}
catch (Exception e)
{
throw new FFMQException("Cannot create security connector","SECURITY_ERROR",e);
}
}
return connector;
} | [
"public",
"static",
"synchronized",
"SecurityConnector",
"getConnector",
"(",
"FFMQEngineSetup",
"setup",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"connector",
"==",
"null",
")",
"{",
"String",
"connectorType",
"=",
"setup",
".",
"getSecurityConnectorType",
"(... | Get the security connector instance | [
"Get",
"the",
"security",
"connector",
"instance"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/security/SecurityConnectorProvider.java#L38-L72 |
9,428 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/ArithmeticUtils.java | ArithmeticUtils.sum | public static Number sum( Number n1 , Number n2 )
{
Class<?> type = getComputationType(n1,n2);
Number val1 = convertTo(n1,type);
Number val2 = convertTo(n2,type);
if (type == Long.class)
return Long.valueOf(val1.longValue()+val2.longValue());
return new Double(val1.doubleValue()+val2.doubleValue());
} | java | public static Number sum( Number n1 , Number n2 )
{
Class<?> type = getComputationType(n1,n2);
Number val1 = convertTo(n1,type);
Number val2 = convertTo(n2,type);
if (type == Long.class)
return Long.valueOf(val1.longValue()+val2.longValue());
return new Double(val1.doubleValue()+val2.doubleValue());
} | [
"public",
"static",
"Number",
"sum",
"(",
"Number",
"n1",
",",
"Number",
"n2",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"getComputationType",
"(",
"n1",
",",
"n2",
")",
";",
"Number",
"val1",
"=",
"convertTo",
"(",
"n1",
",",
"type",
")",
";"... | Sum two numbers | [
"Sum",
"two",
"numbers"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/ArithmeticUtils.java#L28-L38 |
9,429 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/ArithmeticUtils.java | ArithmeticUtils.minus | public static Number minus( Number n )
{
Number value = normalize(n);
Class<?> type = value.getClass();
if (type == Long.class)
return Long.valueOf(-n.longValue());
return new Double(-n.doubleValue());
} | java | public static Number minus( Number n )
{
Number value = normalize(n);
Class<?> type = value.getClass();
if (type == Long.class)
return Long.valueOf(-n.longValue());
return new Double(-n.doubleValue());
} | [
"public",
"static",
"Number",
"minus",
"(",
"Number",
"n",
")",
"{",
"Number",
"value",
"=",
"normalize",
"(",
"n",
")",
";",
"Class",
"<",
"?",
">",
"type",
"=",
"value",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"type",
"==",
"Long",
".",
"cla... | Negate a number | [
"Negate",
"a",
"number"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/ArithmeticUtils.java#L94-L103 |
9,430 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/ArithmeticUtils.java | ArithmeticUtils.greaterThan | public static Boolean greaterThan( Number n1 , Number n2 )
{
Class<?> type = getComputationType(n1,n2);
Number val1 = convertTo(n1,type);
Number val2 = convertTo(n2,type);
if (type == Long.class)
return val1.longValue() > val2.longValue() ? Boolean.TRUE : Boolean.FALSE;
return val1.doubleValue() > val2.doubleValue() ? Boolean.TRUE : Boolean.FALSE;
} | java | public static Boolean greaterThan( Number n1 , Number n2 )
{
Class<?> type = getComputationType(n1,n2);
Number val1 = convertTo(n1,type);
Number val2 = convertTo(n2,type);
if (type == Long.class)
return val1.longValue() > val2.longValue() ? Boolean.TRUE : Boolean.FALSE;
return val1.doubleValue() > val2.doubleValue() ? Boolean.TRUE : Boolean.FALSE;
} | [
"public",
"static",
"Boolean",
"greaterThan",
"(",
"Number",
"n1",
",",
"Number",
"n2",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"getComputationType",
"(",
"n1",
",",
"n2",
")",
";",
"Number",
"val1",
"=",
"convertTo",
"(",
"n1",
",",
"type",
"... | Compare two numbers | [
"Compare",
"two",
"numbers"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/ArithmeticUtils.java#L108-L117 |
9,431 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/MessageSelector.java | MessageSelector.matches | public boolean matches( Message message ) throws JMSException
{
Boolean result = selectorTree != null ? selectorTree.evaluateBoolean(message) : null;
return result != null && result.booleanValue();
} | java | public boolean matches( Message message ) throws JMSException
{
Boolean result = selectorTree != null ? selectorTree.evaluateBoolean(message) : null;
return result != null && result.booleanValue();
} | [
"public",
"boolean",
"matches",
"(",
"Message",
"message",
")",
"throws",
"JMSException",
"{",
"Boolean",
"result",
"=",
"selectorTree",
"!=",
"null",
"?",
"selectorTree",
".",
"evaluateBoolean",
"(",
"message",
")",
":",
"null",
";",
"return",
"result",
"!=",... | Test the selector against a given message | [
"Test",
"the",
"selector",
"against",
"a",
"given",
"message"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageSelector.java#L53-L57 |
9,432 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java | LocalConnection.checkPermission | public final void checkPermission( Destination destination , String action ) throws JMSException
{
if (securityContext == null)
return; // Security is disabled
DestinationRef destinationRef = DestinationTools.asRef(destination);
securityContext.checkPermission(destinationRef.getResourceName(), action);
} | java | public final void checkPermission( Destination destination , String action ) throws JMSException
{
if (securityContext == null)
return; // Security is disabled
DestinationRef destinationRef = DestinationTools.asRef(destination);
securityContext.checkPermission(destinationRef.getResourceName(), action);
} | [
"public",
"final",
"void",
"checkPermission",
"(",
"Destination",
"destination",
",",
"String",
"action",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"securityContext",
"==",
"null",
")",
"return",
";",
"// Security is disabled",
"DestinationRef",
"destinationRef",... | Check if the connection has the required credentials to use
the given destination | [
"Check",
"if",
"the",
"connection",
"has",
"the",
"required",
"credentials",
"to",
"use",
"the",
"given",
"destination"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java#L182-L189 |
9,433 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java | LocalConnection.checkPermission | public final void checkPermission( String resource , String action ) throws JMSException
{
if (securityContext == null)
return; // Security is disabled
securityContext.checkPermission(resource, action);
} | java | public final void checkPermission( String resource , String action ) throws JMSException
{
if (securityContext == null)
return; // Security is disabled
securityContext.checkPermission(resource, action);
} | [
"public",
"final",
"void",
"checkPermission",
"(",
"String",
"resource",
",",
"String",
"action",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"securityContext",
"==",
"null",
")",
"return",
";",
"// Security is disabled",
"securityContext",
".",
"checkPermission"... | Check if the connection has the required credentials to use the given resource | [
"Check",
"if",
"the",
"connection",
"has",
"the",
"required",
"credentials",
"to",
"use",
"the",
"given",
"resource"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java#L203-L209 |
9,434 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java | SelectorNode.negate | protected final Object negate( Object value )
{
if (value == null)
return null;
return ((Boolean)value).booleanValue() ? Boolean.FALSE : Boolean.TRUE;
} | java | protected final Object negate( Object value )
{
if (value == null)
return null;
return ((Boolean)value).booleanValue() ? Boolean.FALSE : Boolean.TRUE;
} | [
"protected",
"final",
"Object",
"negate",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"(",
"Boolean",
")",
"value",
")",
".",
"booleanValue",
"(",
")",
"?",
"Boolean",
".",
"FALSE",
"... | Negate a boolean value | [
"Negate",
"a",
"boolean",
"value"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java#L39-L45 |
9,435 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java | SelectorNode.evaluateBoolean | public final Boolean evaluateBoolean( Message message ) throws JMSException
{
Object value = evaluate(message);
if (value == null)
return null;
if (value instanceof Boolean)
return (Boolean)value;
throw new FFMQException("Expected a boolean but got : "+value.toString(),"INVALID_SELECTOR_EXPRESSION");
} | java | public final Boolean evaluateBoolean( Message message ) throws JMSException
{
Object value = evaluate(message);
if (value == null)
return null;
if (value instanceof Boolean)
return (Boolean)value;
throw new FFMQException("Expected a boolean but got : "+value.toString(),"INVALID_SELECTOR_EXPRESSION");
} | [
"public",
"final",
"Boolean",
"evaluateBoolean",
"(",
"Message",
"message",
")",
"throws",
"JMSException",
"{",
"Object",
"value",
"=",
"evaluate",
"(",
"message",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"value",
... | Evaluate this node as a boolean | [
"Evaluate",
"this",
"node",
"as",
"a",
"boolean"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java#L50-L60 |
9,436 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java | SelectorNode.evaluateNumeric | public final Number evaluateNumeric( Message message ) throws JMSException
{
Object value = evaluate(message);
if (value == null)
return null;
if (value instanceof Number)
return ArithmeticUtils.normalize((Number)value);
throw new FFMQException("Expected a numeric but got : "+value.toString(),"INVALID_SELECTOR_EXPRESSION");
} | java | public final Number evaluateNumeric( Message message ) throws JMSException
{
Object value = evaluate(message);
if (value == null)
return null;
if (value instanceof Number)
return ArithmeticUtils.normalize((Number)value);
throw new FFMQException("Expected a numeric but got : "+value.toString(),"INVALID_SELECTOR_EXPRESSION");
} | [
"public",
"final",
"Number",
"evaluateNumeric",
"(",
"Message",
"message",
")",
"throws",
"JMSException",
"{",
"Object",
"value",
"=",
"evaluate",
"(",
"message",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"value",
... | Evaluate this node as a number | [
"Evaluate",
"this",
"node",
"as",
"a",
"number"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java#L65-L75 |
9,437 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java | SelectorNode.evaluateString | public final String evaluateString( Message message ) throws JMSException
{
Object value = evaluate(message);
if (value == null)
return null;
if (value instanceof String)
return (String)value;
throw new FFMQException("Expected a string but got : "+value.toString(),"INVALID_SELECTOR_EXPRESSION");
} | java | public final String evaluateString( Message message ) throws JMSException
{
Object value = evaluate(message);
if (value == null)
return null;
if (value instanceof String)
return (String)value;
throw new FFMQException("Expected a string but got : "+value.toString(),"INVALID_SELECTOR_EXPRESSION");
} | [
"public",
"final",
"String",
"evaluateString",
"(",
"Message",
"message",
")",
"throws",
"JMSException",
"{",
"Object",
"value",
"=",
"evaluate",
"(",
"message",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"value",
... | Evaluate this node as a string | [
"Evaluate",
"this",
"node",
"as",
"a",
"string"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java#L80-L90 |
9,438 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java | SelectorNode.getNodeType | protected final int getNodeType( Object value )
{
if (value instanceof String)
return SelectorNodeType.STRING;
if (value instanceof Boolean)
return SelectorNodeType.BOOLEAN;
return SelectorNodeType.NUMBER;
} | java | protected final int getNodeType( Object value )
{
if (value instanceof String)
return SelectorNodeType.STRING;
if (value instanceof Boolean)
return SelectorNodeType.BOOLEAN;
return SelectorNodeType.NUMBER;
} | [
"protected",
"final",
"int",
"getNodeType",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"String",
")",
"return",
"SelectorNodeType",
".",
"STRING",
";",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"return",
"SelectorNodeType",
"."... | Get the type of a given value | [
"Get",
"the",
"type",
"of",
"a",
"given",
"value"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/SelectorNode.java#L95-L104 |
9,439 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/subscription/DurableSubscriptionManager.java | DurableSubscriptionManager.register | public boolean register( String clientID , String subscriptionName )
{
String key = clientID+"-"+subscriptionName;
synchronized (subscriptions)
{
if (subscriptions.containsKey(key))
return false;
subscriptions.put(key, new DurableTopicSubscription(System.currentTimeMillis(),
clientID,
subscriptionName));
return true;
}
} | java | public boolean register( String clientID , String subscriptionName )
{
String key = clientID+"-"+subscriptionName;
synchronized (subscriptions)
{
if (subscriptions.containsKey(key))
return false;
subscriptions.put(key, new DurableTopicSubscription(System.currentTimeMillis(),
clientID,
subscriptionName));
return true;
}
} | [
"public",
"boolean",
"register",
"(",
"String",
"clientID",
",",
"String",
"subscriptionName",
")",
"{",
"String",
"key",
"=",
"clientID",
"+",
"\"-\"",
"+",
"subscriptionName",
";",
"synchronized",
"(",
"subscriptions",
")",
"{",
"if",
"(",
"subscriptions",
"... | Register a new durable subscription
@param clientID
@param subscriptionName | [
"Register",
"a",
"new",
"durable",
"subscription"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/subscription/DurableSubscriptionManager.java#L40-L53 |
9,440 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/subscription/DurableSubscriptionManager.java | DurableSubscriptionManager.unregister | public boolean unregister( String clientID , String subscriptionName )
{
String key = clientID+"-"+subscriptionName;
return subscriptions.remove(key) != null;
} | java | public boolean unregister( String clientID , String subscriptionName )
{
String key = clientID+"-"+subscriptionName;
return subscriptions.remove(key) != null;
} | [
"public",
"boolean",
"unregister",
"(",
"String",
"clientID",
",",
"String",
"subscriptionName",
")",
"{",
"String",
"key",
"=",
"clientID",
"+",
"\"-\"",
"+",
"subscriptionName",
";",
"return",
"subscriptions",
".",
"remove",
"(",
"key",
")",
"!=",
"null",
... | Unregister a durable subscription
@param clientID
@param subscriptionName
@return true if the subscription was removed, false if not found | [
"Unregister",
"a",
"durable",
"subscription"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/subscription/DurableSubscriptionManager.java#L61-L65 |
9,441 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/subscription/DurableSubscriptionManager.java | DurableSubscriptionManager.isRegistered | public boolean isRegistered( String clientID , String subscriptionName )
{
String key = clientID+"-"+subscriptionName;
return subscriptions.containsKey(key);
} | java | public boolean isRegistered( String clientID , String subscriptionName )
{
String key = clientID+"-"+subscriptionName;
return subscriptions.containsKey(key);
} | [
"public",
"boolean",
"isRegistered",
"(",
"String",
"clientID",
",",
"String",
"subscriptionName",
")",
"{",
"String",
"key",
"=",
"clientID",
"+",
"\"-\"",
"+",
"subscriptionName",
";",
"return",
"subscriptions",
".",
"containsKey",
"(",
"key",
")",
";",
"}"
... | Test if a durable subscription exists
@param clientID
@param subscriptionName
@return true if the subscription exists | [
"Test",
"if",
"a",
"durable",
"subscription",
"exists"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/subscription/DurableSubscriptionManager.java#L73-L77 |
9,442 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java | MessageSerializer.serialize | public static byte[] serialize( AbstractMessage message , int typicalSize )
{
RawDataBuffer rawMsg = message.getRawMessage();
if (rawMsg != null)
return rawMsg.toByteArray();
RawDataBuffer buffer = new RawDataBuffer(typicalSize);
buffer.writeByte(message.getType());
message.serializeTo(buffer);
return buffer.toByteArray();
} | java | public static byte[] serialize( AbstractMessage message , int typicalSize )
{
RawDataBuffer rawMsg = message.getRawMessage();
if (rawMsg != null)
return rawMsg.toByteArray();
RawDataBuffer buffer = new RawDataBuffer(typicalSize);
buffer.writeByte(message.getType());
message.serializeTo(buffer);
return buffer.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"serialize",
"(",
"AbstractMessage",
"message",
",",
"int",
"typicalSize",
")",
"{",
"RawDataBuffer",
"rawMsg",
"=",
"message",
".",
"getRawMessage",
"(",
")",
";",
"if",
"(",
"rawMsg",
"!=",
"null",
")",
"return",
"ra... | Serialize a message | [
"Serialize",
"a",
"message"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java#L33-L44 |
9,443 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java | MessageSerializer.unserialize | public static AbstractMessage unserialize( byte[] rawData , boolean asInternalCopy )
{
RawDataBuffer rawIn = new RawDataBuffer(rawData);
byte type = rawIn.readByte();
AbstractMessage message = MessageType.createInstance(type);
message.initializeFromRaw(rawIn);
if (asInternalCopy)
message.setInternalCopy(true);
return message;
} | java | public static AbstractMessage unserialize( byte[] rawData , boolean asInternalCopy )
{
RawDataBuffer rawIn = new RawDataBuffer(rawData);
byte type = rawIn.readByte();
AbstractMessage message = MessageType.createInstance(type);
message.initializeFromRaw(rawIn);
if (asInternalCopy)
message.setInternalCopy(true);
return message;
} | [
"public",
"static",
"AbstractMessage",
"unserialize",
"(",
"byte",
"[",
"]",
"rawData",
",",
"boolean",
"asInternalCopy",
")",
"{",
"RawDataBuffer",
"rawIn",
"=",
"new",
"RawDataBuffer",
"(",
"rawData",
")",
";",
"byte",
"type",
"=",
"rawIn",
".",
"readByte",
... | Unserialize a message | [
"Unserialize",
"a",
"message"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java#L49-L59 |
9,444 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java | MessageSerializer.serializeTo | public static void serializeTo( AbstractMessage message , RawDataBuffer out )
{
// Do we have a cached version of the raw message ?
RawDataBuffer rawMsg = message.getRawMessage();
if (rawMsg != null)
{
out.writeInt(rawMsg.size());
rawMsg.writeTo(out);
}
else
{
// Serialize the message
out.writeInt(0); // Write a dummy size
int startPos = out.size();
out.writeByte(message.getType());
message.serializeTo(out);
int endPos = out.size();
out.writeInt(endPos-startPos,startPos-4); // Update the actual size
}
} | java | public static void serializeTo( AbstractMessage message , RawDataBuffer out )
{
// Do we have a cached version of the raw message ?
RawDataBuffer rawMsg = message.getRawMessage();
if (rawMsg != null)
{
out.writeInt(rawMsg.size());
rawMsg.writeTo(out);
}
else
{
// Serialize the message
out.writeInt(0); // Write a dummy size
int startPos = out.size();
out.writeByte(message.getType());
message.serializeTo(out);
int endPos = out.size();
out.writeInt(endPos-startPos,startPos-4); // Update the actual size
}
} | [
"public",
"static",
"void",
"serializeTo",
"(",
"AbstractMessage",
"message",
",",
"RawDataBuffer",
"out",
")",
"{",
"// Do we have a cached version of the raw message ?",
"RawDataBuffer",
"rawMsg",
"=",
"message",
".",
"getRawMessage",
"(",
")",
";",
"if",
"(",
"rawM... | Serialize a message to the given output stream | [
"Serialize",
"a",
"message",
"to",
"the",
"given",
"output",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java#L64-L83 |
9,445 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java | MessageSerializer.unserializeFrom | public static AbstractMessage unserializeFrom( RawDataBuffer rawIn , boolean asInternalCopy )
{
int size = rawIn.readInt();
// Extract a sub buffer
RawDataBuffer rawMessage = new RawDataBuffer(rawIn.readBytes(size));
byte type = rawMessage.readByte();
AbstractMessage message = MessageType.createInstance(type);
message.initializeFromRaw(rawMessage);
if (asInternalCopy)
message.setInternalCopy(true);
return message;
} | java | public static AbstractMessage unserializeFrom( RawDataBuffer rawIn , boolean asInternalCopy )
{
int size = rawIn.readInt();
// Extract a sub buffer
RawDataBuffer rawMessage = new RawDataBuffer(rawIn.readBytes(size));
byte type = rawMessage.readByte();
AbstractMessage message = MessageType.createInstance(type);
message.initializeFromRaw(rawMessage);
if (asInternalCopy)
message.setInternalCopy(true);
return message;
} | [
"public",
"static",
"AbstractMessage",
"unserializeFrom",
"(",
"RawDataBuffer",
"rawIn",
",",
"boolean",
"asInternalCopy",
")",
"{",
"int",
"size",
"=",
"rawIn",
".",
"readInt",
"(",
")",
";",
"// Extract a sub buffer",
"RawDataBuffer",
"rawMessage",
"=",
"new",
"... | Unserialize a message from the given input stream | [
"Unserialize",
"a",
"message",
"from",
"the",
"given",
"input",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/MessageSerializer.java#L88-L101 |
9,446 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/StringTools.java | StringTools.rightPad | public static String rightPad( String value , int size , char padChar )
{
if (value.length() >= size)
return value;
StringBuilder result = new StringBuilder(size);
result.append(value);
for (int n = 0 ; n < size-value.length() ; n++)
result.append(padChar);
return result.toString();
} | java | public static String rightPad( String value , int size , char padChar )
{
if (value.length() >= size)
return value;
StringBuilder result = new StringBuilder(size);
result.append(value);
for (int n = 0 ; n < size-value.length() ; n++)
result.append(padChar);
return result.toString();
} | [
"public",
"static",
"String",
"rightPad",
"(",
"String",
"value",
",",
"int",
"size",
",",
"char",
"padChar",
")",
"{",
"if",
"(",
"value",
".",
"length",
"(",
")",
">=",
"size",
")",
"return",
"value",
";",
"StringBuilder",
"result",
"=",
"new",
"Stri... | Right pad the given string | [
"Right",
"pad",
"the",
"given",
"string"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/StringTools.java#L51-L61 |
9,447 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/StringTools.java | StringTools.formatSize | public static String formatSize( long size )
{
if (size == 0)
return "0";
StringBuilder sb = new StringBuilder();
if (size < 0)
{
size = -size;
sb.append("-");
}
long gigs = size / (1024*1024*1024);
if (gigs > 0)
{
sb.append(new DecimalFormat("######.###").format((double)size/(1024*1024*1024)));
sb.append(" GB");
return sb.toString();
}
long megs = size / (1024*1024);
if (megs > 0)
{
sb.append(new DecimalFormat("###.#").format((double)size/(1024*1024)));
sb.append(" MB");
return sb.toString();
}
long kbs = size / (1024);
if (kbs > 0)
{
sb.append(new DecimalFormat("###.#").format((double)size/(1024)));
sb.append(" KB");
return sb.toString();
}
sb.append(size);
sb.append(" B");
return sb.toString();
} | java | public static String formatSize( long size )
{
if (size == 0)
return "0";
StringBuilder sb = new StringBuilder();
if (size < 0)
{
size = -size;
sb.append("-");
}
long gigs = size / (1024*1024*1024);
if (gigs > 0)
{
sb.append(new DecimalFormat("######.###").format((double)size/(1024*1024*1024)));
sb.append(" GB");
return sb.toString();
}
long megs = size / (1024*1024);
if (megs > 0)
{
sb.append(new DecimalFormat("###.#").format((double)size/(1024*1024)));
sb.append(" MB");
return sb.toString();
}
long kbs = size / (1024);
if (kbs > 0)
{
sb.append(new DecimalFormat("###.#").format((double)size/(1024)));
sb.append(" KB");
return sb.toString();
}
sb.append(size);
sb.append(" B");
return sb.toString();
} | [
"public",
"static",
"String",
"formatSize",
"(",
"long",
"size",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"\"0\"",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"size",
"<",
"0",
")",
"{",
"size",
... | Format the given size | [
"Format",
"the",
"given",
"size"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/StringTools.java#L310-L350 |
9,448 | sbtourist/Journal.IO | src/main/java/journal/io/api/Journal.java | Journal.close | public synchronized void close() throws IOException {
if (!opened) {
return;
}
//
opened = false;
accessor.close();
appender.close();
hints.clear();
inflightWrites.clear();
//
if (managedWriter) {
((ExecutorService) writer).shutdown();
writer = null;
}
if (managedDisposer) {
disposer.shutdown();
disposer = null;
}
} | java | public synchronized void close() throws IOException {
if (!opened) {
return;
}
//
opened = false;
accessor.close();
appender.close();
hints.clear();
inflightWrites.clear();
//
if (managedWriter) {
((ExecutorService) writer).shutdown();
writer = null;
}
if (managedDisposer) {
disposer.shutdown();
disposer = null;
}
} | [
"public",
"synchronized",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"opened",
")",
"{",
"return",
";",
"}",
"//",
"opened",
"=",
"false",
";",
"accessor",
".",
"close",
"(",
")",
";",
"appender",
".",
"close",
"(",
")",... | Close the journal.
@throws IOException | [
"Close",
"the",
"journal",
"."
] | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/Journal.java#L215-L234 |
9,449 | sbtourist/Journal.IO | src/main/java/journal/io/api/Journal.java | Journal.sync | public void sync() throws ClosedJournalException, IOException {
try {
appender.sync().get();
if (appender.getAsyncException() != null) {
throw new IOException(appender.getAsyncException());
}
} catch (Exception ex) {
throw new IllegalStateException(ex.getMessage(), ex);
}
} | java | public void sync() throws ClosedJournalException, IOException {
try {
appender.sync().get();
if (appender.getAsyncException() != null) {
throw new IOException(appender.getAsyncException());
}
} catch (Exception ex) {
throw new IllegalStateException(ex.getMessage(), ex);
}
} | [
"public",
"void",
"sync",
"(",
")",
"throws",
"ClosedJournalException",
",",
"IOException",
"{",
"try",
"{",
"appender",
".",
"sync",
"(",
")",
".",
"get",
"(",
")",
";",
"if",
"(",
"appender",
".",
"getAsyncException",
"(",
")",
"!=",
"null",
")",
"{"... | Sync asynchronously written records on disk.
@throws IOException
@throws ClosedJournalException | [
"Sync",
"asynchronously",
"written",
"records",
"on",
"disk",
"."
] | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/Journal.java#L272-L281 |
9,450 | sbtourist/Journal.IO | src/main/java/journal/io/api/Journal.java | Journal.truncate | public synchronized void truncate() throws OpenJournalException, IOException {
if (!opened) {
for (DataFile file : dataFiles.values()) {
removeDataFile(file);
}
} else {
throw new OpenJournalException("The journal is open! The journal must be closed to be truncated.");
}
} | java | public synchronized void truncate() throws OpenJournalException, IOException {
if (!opened) {
for (DataFile file : dataFiles.values()) {
removeDataFile(file);
}
} else {
throw new OpenJournalException("The journal is open! The journal must be closed to be truncated.");
}
} | [
"public",
"synchronized",
"void",
"truncate",
"(",
")",
"throws",
"OpenJournalException",
",",
"IOException",
"{",
"if",
"(",
"!",
"opened",
")",
"{",
"for",
"(",
"DataFile",
"file",
":",
"dataFiles",
".",
"values",
"(",
")",
")",
"{",
"removeDataFile",
"(... | Truncate the journal, removing all log files. Please note truncate
requires the journal to be closed.
@throws IOException
@throws OpenJournalException | [
"Truncate",
"the",
"journal",
"removing",
"all",
"log",
"files",
".",
"Please",
"note",
"truncate",
"requires",
"the",
"journal",
"to",
"be",
"closed",
"."
] | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/Journal.java#L290-L298 |
9,451 | sbtourist/Journal.IO | src/main/java/journal/io/api/Journal.java | Journal.redo | public Iterable<Location> redo() throws ClosedJournalException, CompactedDataFileException, IOException {
Entry<Integer, DataFile> firstEntry = dataFiles.firstEntry();
if (firstEntry == null) {
return new Redo(null);
}
return new Redo(goToFirstLocation(firstEntry.getValue(), Location.USER_RECORD_TYPE, true));
} | java | public Iterable<Location> redo() throws ClosedJournalException, CompactedDataFileException, IOException {
Entry<Integer, DataFile> firstEntry = dataFiles.firstEntry();
if (firstEntry == null) {
return new Redo(null);
}
return new Redo(goToFirstLocation(firstEntry.getValue(), Location.USER_RECORD_TYPE, true));
} | [
"public",
"Iterable",
"<",
"Location",
">",
"redo",
"(",
")",
"throws",
"ClosedJournalException",
",",
"CompactedDataFileException",
",",
"IOException",
"{",
"Entry",
"<",
"Integer",
",",
"DataFile",
">",
"firstEntry",
"=",
"dataFiles",
".",
"firstEntry",
"(",
"... | Return an iterable to replay the journal by going through all records
locations.
@return
@throws IOException
@throws ClosedJournalException
@throws CompactedDataFileException | [
"Return",
"an",
"iterable",
"to",
"replay",
"the",
"journal",
"by",
"going",
"through",
"all",
"records",
"locations",
"."
] | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/Journal.java#L376-L382 |
9,452 | sbtourist/Journal.IO | src/main/java/journal/io/api/Journal.java | Journal.redo | public Iterable<Location> redo(Location start) throws ClosedJournalException, CompactedDataFileException, IOException {
return new Redo(start);
} | java | public Iterable<Location> redo(Location start) throws ClosedJournalException, CompactedDataFileException, IOException {
return new Redo(start);
} | [
"public",
"Iterable",
"<",
"Location",
">",
"redo",
"(",
"Location",
"start",
")",
"throws",
"ClosedJournalException",
",",
"CompactedDataFileException",
",",
"IOException",
"{",
"return",
"new",
"Redo",
"(",
"start",
")",
";",
"}"
] | Return an iterable to replay the journal by going through all records
locations starting from the given one.
@param start
@return
@throws IOException
@throws CompactedDataFileException
@throws ClosedJournalException | [
"Return",
"an",
"iterable",
"to",
"replay",
"the",
"journal",
"by",
"going",
"through",
"all",
"records",
"locations",
"starting",
"from",
"the",
"given",
"one",
"."
] | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/Journal.java#L394-L396 |
9,453 | sbtourist/Journal.IO | src/main/java/journal/io/api/Journal.java | Journal.undo | public Iterable<Location> undo(Location end) throws ClosedJournalException, CompactedDataFileException, IOException {
return new Undo(redo(end));
} | java | public Iterable<Location> undo(Location end) throws ClosedJournalException, CompactedDataFileException, IOException {
return new Undo(redo(end));
} | [
"public",
"Iterable",
"<",
"Location",
">",
"undo",
"(",
"Location",
"end",
")",
"throws",
"ClosedJournalException",
",",
"CompactedDataFileException",
",",
"IOException",
"{",
"return",
"new",
"Undo",
"(",
"redo",
"(",
"end",
")",
")",
";",
"}"
] | Return an iterable to replay the journal in reverse, starting with the
newest location and ending with the specified end location. The iterable
does not include future writes - writes that happen after its creation.
@param end
@return
@throws IOException
@throws CompactedDataFileException
@throws ClosedJournalException | [
"Return",
"an",
"iterable",
"to",
"replay",
"the",
"journal",
"in",
"reverse",
"starting",
"with",
"the",
"newest",
"location",
"and",
"ending",
"with",
"the",
"specified",
"end",
"location",
".",
"The",
"iterable",
"does",
"not",
"include",
"future",
"writes"... | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/Journal.java#L423-L425 |
9,454 | sbtourist/Journal.IO | src/main/java/journal/io/api/Journal.java | Journal.getFiles | public List<File> getFiles() {
List<File> result = new LinkedList<File>();
for (DataFile dataFile : dataFiles.values()) {
result.add(dataFile.getFile());
}
return result;
} | java | public List<File> getFiles() {
List<File> result = new LinkedList<File>();
for (DataFile dataFile : dataFiles.values()) {
result.add(dataFile.getFile());
}
return result;
} | [
"public",
"List",
"<",
"File",
">",
"getFiles",
"(",
")",
"{",
"List",
"<",
"File",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")",
";",
"for",
"(",
"DataFile",
"dataFile",
":",
"dataFiles",
".",
"values",
"(",
")",
")",
"{",
... | Get the files part of this journal.
@return | [
"Get",
"the",
"files",
"part",
"of",
"this",
"journal",
"."
] | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/Journal.java#L432-L438 |
9,455 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.exceptionOccured | public final void exceptionOccured( JMSException exception )
{
try
{
synchronized (exceptionListenerLock)
{
if (exceptionListener != null)
exceptionListener.onException(exception);
}
}
catch (Exception e)
{
log.error("Exception listener failed",e);
}
} | java | public final void exceptionOccured( JMSException exception )
{
try
{
synchronized (exceptionListenerLock)
{
if (exceptionListener != null)
exceptionListener.onException(exception);
}
}
catch (Exception e)
{
log.error("Exception listener failed",e);
}
} | [
"public",
"final",
"void",
"exceptionOccured",
"(",
"JMSException",
"exception",
")",
"{",
"try",
"{",
"synchronized",
"(",
"exceptionListenerLock",
")",
"{",
"if",
"(",
"exceptionListener",
"!=",
"null",
")",
"exceptionListener",
".",
"onException",
"(",
"excepti... | Triggered when a JMSException is internally catched | [
"Triggered",
"when",
"a",
"JMSException",
"is",
"internally",
"catched"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L173-L187 |
9,456 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.dropTemporaryQueues | private void dropTemporaryQueues()
{
synchronized (temporaryQueues)
{
Iterator<String> remainingQueues = temporaryQueues.iterator();
while (remainingQueues.hasNext())
{
String queueName = remainingQueues.next();
try
{
deleteTemporaryQueue(queueName);
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
}
}
} | java | private void dropTemporaryQueues()
{
synchronized (temporaryQueues)
{
Iterator<String> remainingQueues = temporaryQueues.iterator();
while (remainingQueues.hasNext())
{
String queueName = remainingQueues.next();
try
{
deleteTemporaryQueue(queueName);
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
}
}
} | [
"private",
"void",
"dropTemporaryQueues",
"(",
")",
"{",
"synchronized",
"(",
"temporaryQueues",
")",
"{",
"Iterator",
"<",
"String",
">",
"remainingQueues",
"=",
"temporaryQueues",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"remainingQueues",
".",
"hasNext",... | Drop all registered temporary queues | [
"Drop",
"all",
"registered",
"temporary",
"queues"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L258-L276 |
9,457 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.closeRemainingSessions | private void closeRemainingSessions()
{
if (sessions == null)
return;
List<AbstractSession> sessionsToClose = new ArrayList<>(sessions.size());
synchronized (sessions)
{
sessionsToClose.addAll(sessions.values());
}
for (int n = 0 ; n < sessionsToClose.size() ; n++)
{
Session session = sessionsToClose.get(n);
log.debug("Auto-closing unclosed session : "+session);
try
{
session.close();
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
}
} | java | private void closeRemainingSessions()
{
if (sessions == null)
return;
List<AbstractSession> sessionsToClose = new ArrayList<>(sessions.size());
synchronized (sessions)
{
sessionsToClose.addAll(sessions.values());
}
for (int n = 0 ; n < sessionsToClose.size() ; n++)
{
Session session = sessionsToClose.get(n);
log.debug("Auto-closing unclosed session : "+session);
try
{
session.close();
}
catch (JMSException e)
{
ErrorTools.log(e, log);
}
}
} | [
"private",
"void",
"closeRemainingSessions",
"(",
")",
"{",
"if",
"(",
"sessions",
"==",
"null",
")",
"return",
";",
"List",
"<",
"AbstractSession",
">",
"sessionsToClose",
"=",
"new",
"ArrayList",
"<>",
"(",
"sessions",
".",
"size",
"(",
")",
")",
";",
... | Close remaining sessions | [
"Close",
"remaining",
"sessions"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L326-L349 |
9,458 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.waitForDeliverySync | protected final void waitForDeliverySync()
{
List<AbstractSession> sessionsSnapshot = new ArrayList<>(sessions.size());
synchronized (sessions)
{
sessionsSnapshot.addAll(sessions.values());
}
for(int n=0;n<sessionsSnapshot.size();n++)
{
AbstractSession session = sessionsSnapshot.get(n);
session.waitForDeliverySync();
}
} | java | protected final void waitForDeliverySync()
{
List<AbstractSession> sessionsSnapshot = new ArrayList<>(sessions.size());
synchronized (sessions)
{
sessionsSnapshot.addAll(sessions.values());
}
for(int n=0;n<sessionsSnapshot.size();n++)
{
AbstractSession session = sessionsSnapshot.get(n);
session.waitForDeliverySync();
}
} | [
"protected",
"final",
"void",
"waitForDeliverySync",
"(",
")",
"{",
"List",
"<",
"AbstractSession",
">",
"sessionsSnapshot",
"=",
"new",
"ArrayList",
"<>",
"(",
"sessions",
".",
"size",
"(",
")",
")",
";",
"synchronized",
"(",
"sessions",
")",
"{",
"sessions... | Wait for sessions to finish the current deliveridispatching | [
"Wait",
"for",
"sessions",
"to",
"finish",
"the",
"current",
"deliveridispatching"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L379-L391 |
9,459 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.registerSession | protected final void registerSession( AbstractSession sessionToAdd )
{
if (sessions.put(sessionToAdd.getId(),sessionToAdd) != null)
throw new IllegalArgumentException("Session "+sessionToAdd.getId()+" already exists");
} | java | protected final void registerSession( AbstractSession sessionToAdd )
{
if (sessions.put(sessionToAdd.getId(),sessionToAdd) != null)
throw new IllegalArgumentException("Session "+sessionToAdd.getId()+" already exists");
} | [
"protected",
"final",
"void",
"registerSession",
"(",
"AbstractSession",
"sessionToAdd",
")",
"{",
"if",
"(",
"sessions",
".",
"put",
"(",
"sessionToAdd",
".",
"getId",
"(",
")",
",",
"sessionToAdd",
")",
"!=",
"null",
")",
"throw",
"new",
"IllegalArgumentExce... | Register a session | [
"Register",
"a",
"session"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L404-L408 |
9,460 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.unregisterSession | public final void unregisterSession( AbstractSession sessionToRemove )
{
if (sessions.remove(sessionToRemove.getId()) == null)
log.warn("Unknown session : "+sessionToRemove);
} | java | public final void unregisterSession( AbstractSession sessionToRemove )
{
if (sessions.remove(sessionToRemove.getId()) == null)
log.warn("Unknown session : "+sessionToRemove);
} | [
"public",
"final",
"void",
"unregisterSession",
"(",
"AbstractSession",
"sessionToRemove",
")",
"{",
"if",
"(",
"sessions",
".",
"remove",
"(",
"sessionToRemove",
".",
"getId",
"(",
")",
")",
"==",
"null",
")",
"log",
".",
"warn",
"(",
"\"Unknown session : \""... | Unregister a session | [
"Unregister",
"a",
"session"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L413-L417 |
9,461 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java | AbstractConnection.getConsumersCount | public int getConsumersCount()
{
synchronized (sessions)
{
if (sessions.isEmpty())
return 0;
int total = 0;
Iterator<AbstractSession>sessionsIterator = sessions.values().iterator();
while (sessionsIterator.hasNext())
{
AbstractSession session = sessionsIterator.next();
total += session.getConsumersCount();
}
return total;
}
} | java | public int getConsumersCount()
{
synchronized (sessions)
{
if (sessions.isEmpty())
return 0;
int total = 0;
Iterator<AbstractSession>sessionsIterator = sessions.values().iterator();
while (sessionsIterator.hasNext())
{
AbstractSession session = sessionsIterator.next();
total += session.getConsumersCount();
}
return total;
}
} | [
"public",
"int",
"getConsumersCount",
"(",
")",
"{",
"synchronized",
"(",
"sessions",
")",
"{",
"if",
"(",
"sessions",
".",
"isEmpty",
"(",
")",
")",
"return",
"0",
";",
"int",
"total",
"=",
"0",
";",
"Iterator",
"<",
"AbstractSession",
">",
"sessionsIte... | Get the number of active producers for this connection
@return the number of active producers for this connection | [
"Get",
"the",
"number",
"of",
"active",
"producers",
"for",
"this",
"connection"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/connection/AbstractConnection.java#L490-L506 |
9,462 | sbtourist/Journal.IO | src/main/java/journal/io/api/DataFileAppender.java | DataFileAppender.signalBatch | private void signalBatch() {
writer.execute(new Runnable() {
@Override
public void run() {
// Wait for other threads writing on the same journal to finish:
while (writing.compareAndSet(false, true) == false) {
try {
Thread.sleep(SPIN_BACKOFF);
} catch (Exception ex) {
}
}
// TODO: Improve by employing different spinning strategies?
WriteBatch wb = batchQueue.poll();
try {
while (wb != null) {
if (!wb.isEmpty()) {
boolean newOrRotated = lastAppendDataFile != wb.getDataFile();
if (newOrRotated) {
if (lastAppendRaf != null) {
lastAppendRaf.close();
}
lastAppendDataFile = wb.getDataFile();
lastAppendRaf = lastAppendDataFile.openRandomAccessFile();
}
// Perform batch:
Location batchLocation = wb.perform(lastAppendRaf, journal.isChecksum(), journal.isPhysicalSync(), journal.getReplicationTarget());
// Add batch location as hint:
journal.getHints().put(batchLocation, batchLocation.getThisFilePosition());
// Adjust journal length:
journal.addToTotalLength(wb.getSize());
// Now that the data is on disk, notify callbacks and remove the writes from the in-flight cache:
for (WriteCommand current : wb.getWrites()) {
try {
current.getLocation().getWriteCallback().onSync(current.getLocation());
} catch (Throwable ex) {
warn(ex, ex.getMessage());
}
journal.getInflightWrites().remove(current.getLocation());
}
// Finally signal any waiting threads that the write is on disk.
wb.getLatch().countDown();
}
// Poll next batch:
wb = batchQueue.poll();
}
} catch (Exception ex) {
// Put back latest batch:
batchQueue.offer(wb);
// Notify error to all locations of all batches, and signal waiting threads:
for (WriteBatch currentBatch : batchQueue) {
for (WriteCommand currentWrite : currentBatch.getWrites()) {
try {
currentWrite.getLocation().getWriteCallback().onError(currentWrite.getLocation(), ex);
} catch (Throwable innerEx) {
warn(innerEx, innerEx.getMessage());
}
}
currentBatch.getLatch().countDown();
}
// Propagate exception:
asyncException.compareAndSet(null, ex);
} finally {
writing.set(false);
}
}
});
} | java | private void signalBatch() {
writer.execute(new Runnable() {
@Override
public void run() {
// Wait for other threads writing on the same journal to finish:
while (writing.compareAndSet(false, true) == false) {
try {
Thread.sleep(SPIN_BACKOFF);
} catch (Exception ex) {
}
}
// TODO: Improve by employing different spinning strategies?
WriteBatch wb = batchQueue.poll();
try {
while (wb != null) {
if (!wb.isEmpty()) {
boolean newOrRotated = lastAppendDataFile != wb.getDataFile();
if (newOrRotated) {
if (lastAppendRaf != null) {
lastAppendRaf.close();
}
lastAppendDataFile = wb.getDataFile();
lastAppendRaf = lastAppendDataFile.openRandomAccessFile();
}
// Perform batch:
Location batchLocation = wb.perform(lastAppendRaf, journal.isChecksum(), journal.isPhysicalSync(), journal.getReplicationTarget());
// Add batch location as hint:
journal.getHints().put(batchLocation, batchLocation.getThisFilePosition());
// Adjust journal length:
journal.addToTotalLength(wb.getSize());
// Now that the data is on disk, notify callbacks and remove the writes from the in-flight cache:
for (WriteCommand current : wb.getWrites()) {
try {
current.getLocation().getWriteCallback().onSync(current.getLocation());
} catch (Throwable ex) {
warn(ex, ex.getMessage());
}
journal.getInflightWrites().remove(current.getLocation());
}
// Finally signal any waiting threads that the write is on disk.
wb.getLatch().countDown();
}
// Poll next batch:
wb = batchQueue.poll();
}
} catch (Exception ex) {
// Put back latest batch:
batchQueue.offer(wb);
// Notify error to all locations of all batches, and signal waiting threads:
for (WriteBatch currentBatch : batchQueue) {
for (WriteCommand currentWrite : currentBatch.getWrites()) {
try {
currentWrite.getLocation().getWriteCallback().onError(currentWrite.getLocation(), ex);
} catch (Throwable innerEx) {
warn(innerEx, innerEx.getMessage());
}
}
currentBatch.getLatch().countDown();
}
// Propagate exception:
asyncException.compareAndSet(null, ex);
} finally {
writing.set(false);
}
}
});
} | [
"private",
"void",
"signalBatch",
"(",
")",
"{",
"writer",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"// Wait for other threads writing on the same journal to finish:",
"while",
"(",
"writing",
... | Signal writer thread to process batches. | [
"Signal",
"writer",
"thread",
"to",
"process",
"batches",
"."
] | 90cb13c822d5ecf6bcd3194c1bc2a11cec827626 | https://github.com/sbtourist/Journal.IO/blob/90cb13c822d5ecf6bcd3194c1bc2a11cec827626/src/main/java/journal/io/api/DataFileAppender.java#L240-L311 |
9,463 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java | BlockBasedDataStoreTools.create | public static void create( String baseName ,
File dataFolder ,
int blockCount ,
int blockSize ,
boolean forceSync ) throws DataStoreException
{
if (blockCount <= 0)
throw new DataStoreException("Block count should be > 0");
if (blockSize <= 0)
throw new DataStoreException("Block size should be > 0");
File atFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.ALLOCATION_TABLE_SUFFIX);
File dataFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.DATA_FILE_SUFFIX);
if (atFile.exists())
throw new DataStoreException("Cannot create store filesystem : "+atFile.getAbsolutePath()+" already exists");
if (dataFile.exists())
throw new DataStoreException("Cannot create store filesystem : "+dataFile.getAbsolutePath()+" already exists");
initAllocationTable(atFile,
blockCount,
blockSize,
forceSync);
initDataFile(dataFile,
blockCount,
blockSize,
forceSync);
} | java | public static void create( String baseName ,
File dataFolder ,
int blockCount ,
int blockSize ,
boolean forceSync ) throws DataStoreException
{
if (blockCount <= 0)
throw new DataStoreException("Block count should be > 0");
if (blockSize <= 0)
throw new DataStoreException("Block size should be > 0");
File atFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.ALLOCATION_TABLE_SUFFIX);
File dataFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.DATA_FILE_SUFFIX);
if (atFile.exists())
throw new DataStoreException("Cannot create store filesystem : "+atFile.getAbsolutePath()+" already exists");
if (dataFile.exists())
throw new DataStoreException("Cannot create store filesystem : "+dataFile.getAbsolutePath()+" already exists");
initAllocationTable(atFile,
blockCount,
blockSize,
forceSync);
initDataFile(dataFile,
blockCount,
blockSize,
forceSync);
} | [
"public",
"static",
"void",
"create",
"(",
"String",
"baseName",
",",
"File",
"dataFolder",
",",
"int",
"blockCount",
",",
"int",
"blockSize",
",",
"boolean",
"forceSync",
")",
"throws",
"DataStoreException",
"{",
"if",
"(",
"blockCount",
"<=",
"0",
")",
"th... | Create the filesystem for a new store | [
"Create",
"the",
"filesystem",
"for",
"a",
"new",
"store"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java#L47-L73 |
9,464 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java | BlockBasedDataStoreTools.initAllocationTable | private static void initAllocationTable(File atFile, int blockCount, int blockSize, boolean forceSync) throws DataStoreException
{
log.debug("Creating allocation table (size=" + blockCount + ") ...");
// Create the file
try
{
FileOutputStream outFile = new FileOutputStream(atFile);
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(outFile));
out.writeInt(blockCount); // Block count
out.writeInt(blockSize); // Block size
out.writeInt(-1); // First block index
for (int n = 0 ; n < blockCount ; n++)
out.write(EMPTY_BLOCK);
out.flush();
if (forceSync)
outFile.getFD().sync();
out.close();
}
catch (IOException e)
{
throw new DataStoreException("Cannot initialize allocation table " + atFile.getAbsolutePath(),e);
}
} | java | private static void initAllocationTable(File atFile, int blockCount, int blockSize, boolean forceSync) throws DataStoreException
{
log.debug("Creating allocation table (size=" + blockCount + ") ...");
// Create the file
try
{
FileOutputStream outFile = new FileOutputStream(atFile);
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(outFile));
out.writeInt(blockCount); // Block count
out.writeInt(blockSize); // Block size
out.writeInt(-1); // First block index
for (int n = 0 ; n < blockCount ; n++)
out.write(EMPTY_BLOCK);
out.flush();
if (forceSync)
outFile.getFD().sync();
out.close();
}
catch (IOException e)
{
throw new DataStoreException("Cannot initialize allocation table " + atFile.getAbsolutePath(),e);
}
} | [
"private",
"static",
"void",
"initAllocationTable",
"(",
"File",
"atFile",
",",
"int",
"blockCount",
",",
"int",
"blockSize",
",",
"boolean",
"forceSync",
")",
"throws",
"DataStoreException",
"{",
"log",
".",
"debug",
"(",
"\"Creating allocation table (size=\"",
"+"... | one 0 byte and three -1 ints | [
"one",
"0",
"byte",
"and",
"three",
"-",
"1",
"ints"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java#L77-L102 |
9,465 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java | BlockBasedDataStoreTools.delete | public static void delete( String baseName ,
File dataFolder ,
boolean force ) throws DataStoreException
{
File[] journalFiles = findJournalFiles(baseName, dataFolder);
if (journalFiles.length > 0)
{
if (force)
{
for (int i = 0; i < journalFiles.length; i++)
{
if (!journalFiles[i].delete())
throw new DataStoreException("Cannot delete file : "+journalFiles[i].getAbsolutePath());
}
}
else
throw new DataStoreException("Journal file exist : "+journalFiles[0].getAbsolutePath());
}
File atFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.ALLOCATION_TABLE_SUFFIX);
if (atFile.exists())
if (!atFile.delete())
throw new DataStoreException("Cannot delete file : "+atFile.getAbsolutePath());
File dataFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.DATA_FILE_SUFFIX);
if (dataFile.exists())
if (!dataFile.delete())
throw new DataStoreException("Cannot delete file : "+dataFile.getAbsolutePath());
} | java | public static void delete( String baseName ,
File dataFolder ,
boolean force ) throws DataStoreException
{
File[] journalFiles = findJournalFiles(baseName, dataFolder);
if (journalFiles.length > 0)
{
if (force)
{
for (int i = 0; i < journalFiles.length; i++)
{
if (!journalFiles[i].delete())
throw new DataStoreException("Cannot delete file : "+journalFiles[i].getAbsolutePath());
}
}
else
throw new DataStoreException("Journal file exist : "+journalFiles[0].getAbsolutePath());
}
File atFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.ALLOCATION_TABLE_SUFFIX);
if (atFile.exists())
if (!atFile.delete())
throw new DataStoreException("Cannot delete file : "+atFile.getAbsolutePath());
File dataFile = new File(dataFolder,baseName+AbstractBlockBasedDataStore.DATA_FILE_SUFFIX);
if (dataFile.exists())
if (!dataFile.delete())
throw new DataStoreException("Cannot delete file : "+dataFile.getAbsolutePath());
} | [
"public",
"static",
"void",
"delete",
"(",
"String",
"baseName",
",",
"File",
"dataFolder",
",",
"boolean",
"force",
")",
"throws",
"DataStoreException",
"{",
"File",
"[",
"]",
"journalFiles",
"=",
"findJournalFiles",
"(",
"baseName",
",",
"dataFolder",
")",
"... | Delete the filesystem of a store | [
"Delete",
"the",
"filesystem",
"of",
"a",
"store"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java#L126-L155 |
9,466 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java | BlockBasedDataStoreTools.findJournalFiles | public static File[] findJournalFiles( String baseName , File dataFolder )
{
final String journalBase = baseName+JournalFile.SUFFIX;
File[] journalFiles = dataFolder.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
public boolean accept(File pathname)
{
if (!pathname.isFile())
return false;
return pathname.getName().startsWith(journalBase) &&
!pathname.getName().endsWith(JournalFile.RECYCLED_SUFFIX);
}
});
// Sort them in ascending order
Arrays.sort(journalFiles, new Comparator<File>() {
@Override
public int compare(File f1, File f2)
{
return f1.getName().compareTo(f2.getName());
}
});
return journalFiles;
} | java | public static File[] findJournalFiles( String baseName , File dataFolder )
{
final String journalBase = baseName+JournalFile.SUFFIX;
File[] journalFiles = dataFolder.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
public boolean accept(File pathname)
{
if (!pathname.isFile())
return false;
return pathname.getName().startsWith(journalBase) &&
!pathname.getName().endsWith(JournalFile.RECYCLED_SUFFIX);
}
});
// Sort them in ascending order
Arrays.sort(journalFiles, new Comparator<File>() {
@Override
public int compare(File f1, File f2)
{
return f1.getName().compareTo(f2.getName());
}
});
return journalFiles;
} | [
"public",
"static",
"File",
"[",
"]",
"findJournalFiles",
"(",
"String",
"baseName",
",",
"File",
"dataFolder",
")",
"{",
"final",
"String",
"journalBase",
"=",
"baseName",
"+",
"JournalFile",
".",
"SUFFIX",
";",
"File",
"[",
"]",
"journalFiles",
"=",
"dataF... | Find existing journal files for a given base name
@param baseName
@param dataFolder
@return an array of journal files | [
"Find",
"existing",
"journal",
"files",
"for",
"a",
"given",
"base",
"name"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java#L163-L192 |
9,467 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java | BlockBasedDataStoreTools.findRecycledJournalFiles | public static File[] findRecycledJournalFiles( String baseName , File dataFolder )
{
final String journalBase = baseName+JournalFile.SUFFIX;
File[] recycledFiles = dataFolder.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
public boolean accept(File pathname)
{
if (!pathname.isFile())
return false;
return pathname.getName().startsWith(journalBase) &&
pathname.getName().endsWith(JournalFile.RECYCLED_SUFFIX);
}
});
return recycledFiles;
} | java | public static File[] findRecycledJournalFiles( String baseName , File dataFolder )
{
final String journalBase = baseName+JournalFile.SUFFIX;
File[] recycledFiles = dataFolder.listFiles(new FileFilter() {
/*
* (non-Javadoc)
* @see java.io.FileFilter#accept(java.io.File)
*/
@Override
public boolean accept(File pathname)
{
if (!pathname.isFile())
return false;
return pathname.getName().startsWith(journalBase) &&
pathname.getName().endsWith(JournalFile.RECYCLED_SUFFIX);
}
});
return recycledFiles;
} | [
"public",
"static",
"File",
"[",
"]",
"findRecycledJournalFiles",
"(",
"String",
"baseName",
",",
"File",
"dataFolder",
")",
"{",
"final",
"String",
"journalBase",
"=",
"baseName",
"+",
"JournalFile",
".",
"SUFFIX",
";",
"File",
"[",
"]",
"recycledFiles",
"=",... | Find recycled journal files for a given base name
@param baseName
@param dataFolder
@return an array of journal files | [
"Find",
"recycled",
"journal",
"files",
"for",
"a",
"given",
"base",
"name"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java#L200-L220 |
9,468 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/async/AsyncTaskManager.java | AsyncTaskManager.execute | public synchronized void execute( AsyncTask task ) throws JMSException
{
AsyncTaskProcessorThread thread = threadPool.borrow(); // Dispatch using new borrowed thread
if (thread != null)
{
thread.setTask(task);
thread.execute();
}
else
{
// All threads are busy ...
if (task.isMergeable())
{
if (!taskSet.add(task))
return; // Already queued
}
// Enqueue task
taskQueue.add(task);
}
} | java | public synchronized void execute( AsyncTask task ) throws JMSException
{
AsyncTaskProcessorThread thread = threadPool.borrow(); // Dispatch using new borrowed thread
if (thread != null)
{
thread.setTask(task);
thread.execute();
}
else
{
// All threads are busy ...
if (task.isMergeable())
{
if (!taskSet.add(task))
return; // Already queued
}
// Enqueue task
taskQueue.add(task);
}
} | [
"public",
"synchronized",
"void",
"execute",
"(",
"AsyncTask",
"task",
")",
"throws",
"JMSException",
"{",
"AsyncTaskProcessorThread",
"thread",
"=",
"threadPool",
".",
"borrow",
"(",
")",
";",
"// Dispatch using new borrowed thread",
"if",
"(",
"thread",
"!=",
"nul... | Asynchronously execute the given task | [
"Asynchronously",
"execute",
"the",
"given",
"task"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/async/AsyncTaskManager.java#L72-L93 |
9,469 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/jndi/FFMQConnectionFactory.java | FFMQConnectionFactory.getProviderURI | protected final URI getProviderURI() throws JMSException
{
String providerURL = getProviderURL();
URI parsedURL;
try
{
parsedURL = new URI(providerURL);
}
catch (URISyntaxException e)
{
throw new FFMQException("Malformed provider URL : "+providerURL,"INVALID_PROVIDER_URL");
}
if (!parsedURL.isAbsolute())
throw new FFMQException("Invalid provider URL : "+providerURL,"INVALID_PROVIDER_URL");
return parsedURL;
} | java | protected final URI getProviderURI() throws JMSException
{
String providerURL = getProviderURL();
URI parsedURL;
try
{
parsedURL = new URI(providerURL);
}
catch (URISyntaxException e)
{
throw new FFMQException("Malformed provider URL : "+providerURL,"INVALID_PROVIDER_URL");
}
if (!parsedURL.isAbsolute())
throw new FFMQException("Invalid provider URL : "+providerURL,"INVALID_PROVIDER_URL");
return parsedURL;
} | [
"protected",
"final",
"URI",
"getProviderURI",
"(",
")",
"throws",
"JMSException",
"{",
"String",
"providerURL",
"=",
"getProviderURL",
"(",
")",
";",
"URI",
"parsedURL",
";",
"try",
"{",
"parsedURL",
"=",
"new",
"URI",
"(",
"providerURL",
")",
";",
"}",
"... | Lookup the provider URI | [
"Lookup",
"the",
"provider",
"URI"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/jndi/FFMQConnectionFactory.java#L174-L190 |
9,470 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalRecovery.java | JournalRecovery.recover | public int recover() throws JournalException
{
int newBlockCount = -1;
log.warn("["+baseName+"] Recovery required for data store : found "+journalFiles.length+" journal file(s)");
for (int i = 0; i < journalFiles.length; i++)
newBlockCount = recoverFromJournalFile(journalFiles[i]);
return newBlockCount;
} | java | public int recover() throws JournalException
{
int newBlockCount = -1;
log.warn("["+baseName+"] Recovery required for data store : found "+journalFiles.length+" journal file(s)");
for (int i = 0; i < journalFiles.length; i++)
newBlockCount = recoverFromJournalFile(journalFiles[i]);
return newBlockCount;
} | [
"public",
"int",
"recover",
"(",
")",
"throws",
"JournalException",
"{",
"int",
"newBlockCount",
"=",
"-",
"1",
";",
"log",
".",
"warn",
"(",
"\"[\"",
"+",
"baseName",
"+",
"\"] Recovery required for data store : found \"",
"+",
"journalFiles",
".",
"length",
"+... | Start the recovery process
@return the new block count of the store, or -1 if unchanged
@throws JournalException | [
"Start",
"the",
"recovery",
"process"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalRecovery.java#L64-L73 |
9,471 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/transport/packet/PacketSerializer.java | PacketSerializer.serializeTo | public static void serializeTo( AbstractPacket packet , RawDataBuffer out )
{
out.writeByte(packet.getType());
packet.serializeTo(out);
} | java | public static void serializeTo( AbstractPacket packet , RawDataBuffer out )
{
out.writeByte(packet.getType());
packet.serializeTo(out);
} | [
"public",
"static",
"void",
"serializeTo",
"(",
"AbstractPacket",
"packet",
",",
"RawDataBuffer",
"out",
")",
"{",
"out",
".",
"writeByte",
"(",
"packet",
".",
"getType",
"(",
")",
")",
";",
"packet",
".",
"serializeTo",
"(",
"out",
")",
";",
"}"
] | Serialize a packet to the given output stream | [
"Serialize",
"a",
"packet",
"to",
"the",
"given",
"output",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/transport/packet/PacketSerializer.java#L30-L34 |
9,472 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/transport/packet/PacketSerializer.java | PacketSerializer.unserializeFrom | public static AbstractPacket unserializeFrom( RawDataBuffer in )
{
byte type = in.readByte();
AbstractPacket packet = PacketType.createInstance(type);
packet.unserializeFrom(in);
return packet;
} | java | public static AbstractPacket unserializeFrom( RawDataBuffer in )
{
byte type = in.readByte();
AbstractPacket packet = PacketType.createInstance(type);
packet.unserializeFrom(in);
return packet;
} | [
"public",
"static",
"AbstractPacket",
"unserializeFrom",
"(",
"RawDataBuffer",
"in",
")",
"{",
"byte",
"type",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"AbstractPacket",
"packet",
"=",
"PacketType",
".",
"createInstance",
"(",
"type",
")",
";",
"packet",
"... | Unserialize a packet from the given input stream | [
"Unserialize",
"a",
"packet",
"from",
"the",
"given",
"input",
"stream"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/transport/packet/PacketSerializer.java#L39-L46 |
9,473 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/AutoCloseables.java | AutoCloseables.closeQuietly | public static void closeQuietly(@Nullable final AutoCloseable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (Exception e) {
LOG.warn("Error closing instance {}.", closeable, e);
}
} | java | public static void closeQuietly(@Nullable final AutoCloseable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (Exception e) {
LOG.warn("Error closing instance {}.", closeable, e);
}
} | [
"public",
"static",
"void",
"closeQuietly",
"(",
"@",
"Nullable",
"final",
"AutoCloseable",
"closeable",
")",
"{",
"try",
"{",
"if",
"(",
"closeable",
"!=",
"null",
")",
"{",
"closeable",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
... | Calls close on the provided instance. If an exception occurs it is logged
instead of propagating it. | [
"Calls",
"close",
"on",
"the",
"provided",
"instance",
".",
"If",
"an",
"exception",
"occurs",
"it",
"is",
"logged",
"instead",
"of",
"propagating",
"it",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/AutoCloseables.java#L58-L66 |
9,474 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/FastBitSet.java | FastBitSet.ensureCapacity | public void ensureCapacity(int requiredBits)
{
int requiredWords = wordIndex(requiredBits - 1) + 1;
if (words.length < requiredWords)
{
long[] newWords = new long[requiredWords];
System.arraycopy(words, 0, newWords, 0, words.length);
words = newWords;
}
} | java | public void ensureCapacity(int requiredBits)
{
int requiredWords = wordIndex(requiredBits - 1) + 1;
if (words.length < requiredWords)
{
long[] newWords = new long[requiredWords];
System.arraycopy(words, 0, newWords, 0, words.length);
words = newWords;
}
} | [
"public",
"void",
"ensureCapacity",
"(",
"int",
"requiredBits",
")",
"{",
"int",
"requiredWords",
"=",
"wordIndex",
"(",
"requiredBits",
"-",
"1",
")",
"+",
"1",
";",
"if",
"(",
"words",
".",
"length",
"<",
"requiredWords",
")",
"{",
"long",
"[",
"]",
... | Ensures that the BitSet can hold enough bits.
@param requiredBits the required number of bits. | [
"Ensures",
"that",
"the",
"BitSet",
"can",
"hold",
"enough",
"bits",
"."
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/FastBitSet.java#L61-L70 |
9,475 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/FastBitSet.java | FastBitSet.flip | public boolean flip(int bitIndex)
{
int wordIndex = wordIndex(bitIndex);
words[wordIndex] ^= (1L << bitIndex);
return ((words[wordIndex] & (1L << bitIndex)) != 0);
} | java | public boolean flip(int bitIndex)
{
int wordIndex = wordIndex(bitIndex);
words[wordIndex] ^= (1L << bitIndex);
return ((words[wordIndex] & (1L << bitIndex)) != 0);
} | [
"public",
"boolean",
"flip",
"(",
"int",
"bitIndex",
")",
"{",
"int",
"wordIndex",
"=",
"wordIndex",
"(",
"bitIndex",
")",
";",
"words",
"[",
"wordIndex",
"]",
"^=",
"(",
"1L",
"<<",
"bitIndex",
")",
";",
"return",
"(",
"(",
"words",
"[",
"wordIndex",
... | Sets the bit at the specified index to the complement of its
current value.
@param bitIndex the index of the bit to flip
@return true if the bit was set to, false if it was unset | [
"Sets",
"the",
"bit",
"at",
"the",
"specified",
"index",
"to",
"the",
"complement",
"of",
"its",
"current",
"value",
"."
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/FastBitSet.java#L78-L84 |
9,476 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/MessageSelectorParser.java | MessageSelectorParser.parse | public SelectorNode parse() throws InvalidSelectorException
{
if (isEndOfExpression())
return null;
SelectorNode expr = parseExpression();
if (!isEndOfExpression())
throw new InvalidSelectorException("Unexpected token : "+currentToken);
if (!(expr instanceof ConditionalExpression))
throw new InvalidSelectorException("Selector expression is not a boolean expression");
return expr;
} | java | public SelectorNode parse() throws InvalidSelectorException
{
if (isEndOfExpression())
return null;
SelectorNode expr = parseExpression();
if (!isEndOfExpression())
throw new InvalidSelectorException("Unexpected token : "+currentToken);
if (!(expr instanceof ConditionalExpression))
throw new InvalidSelectorException("Selector expression is not a boolean expression");
return expr;
} | [
"public",
"SelectorNode",
"parse",
"(",
")",
"throws",
"InvalidSelectorException",
"{",
"if",
"(",
"isEndOfExpression",
"(",
")",
")",
"return",
"null",
";",
"SelectorNode",
"expr",
"=",
"parseExpression",
"(",
")",
";",
"if",
"(",
"!",
"isEndOfExpression",
"(... | Parse the given message selector expression into a selector node tree | [
"Parse",
"the",
"given",
"message",
"selector",
"expression",
"into",
"a",
"selector",
"node",
"tree"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/MessageSelectorParser.java#L107-L118 |
9,477 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java | LocalQueue.unlockAndDeliver | public void unlockAndDeliver( MessageLock lockRef ) throws JMSException
{
MessageStore targetStore;
if (lockRef.getDeliveryMode() == DeliveryMode.NON_PERSISTENT)
targetStore = volatileStore;
else
targetStore = persistentStore;
int handle = lockRef.getHandle();
AbstractMessage message = lockRef.getMessage();
synchronized (storeLock)
{
targetStore.unlock(handle);
}
sentToQueueCount.incrementAndGet();
sendAvailabilityNotification(message);
} | java | public void unlockAndDeliver( MessageLock lockRef ) throws JMSException
{
MessageStore targetStore;
if (lockRef.getDeliveryMode() == DeliveryMode.NON_PERSISTENT)
targetStore = volatileStore;
else
targetStore = persistentStore;
int handle = lockRef.getHandle();
AbstractMessage message = lockRef.getMessage();
synchronized (storeLock)
{
targetStore.unlock(handle);
}
sentToQueueCount.incrementAndGet();
sendAvailabilityNotification(message);
} | [
"public",
"void",
"unlockAndDeliver",
"(",
"MessageLock",
"lockRef",
")",
"throws",
"JMSException",
"{",
"MessageStore",
"targetStore",
";",
"if",
"(",
"lockRef",
".",
"getDeliveryMode",
"(",
")",
"==",
"DeliveryMode",
".",
"NON_PERSISTENT",
")",
"targetStore",
"=... | Unlock a message.
Listeners are automatically notified of the new message availability. | [
"Unlock",
"a",
"message",
".",
"Listeners",
"are",
"automatically",
"notified",
"of",
"the",
"new",
"message",
"availability",
"."
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java#L213-L230 |
9,478 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java | LocalQueue.removeLocked | public void removeLocked( MessageLock lockRef ) throws JMSException
{
checkTransactionLock();
MessageStore targetStore;
if (lockRef.getDeliveryMode() == DeliveryMode.NON_PERSISTENT)
targetStore = volatileStore;
else
{
targetStore = persistentStore;
if (requiresTransactionalUpdate())
pendingChanges = true;
}
synchronized (storeLock)
{
targetStore.delete(lockRef.getHandle());
}
} | java | public void removeLocked( MessageLock lockRef ) throws JMSException
{
checkTransactionLock();
MessageStore targetStore;
if (lockRef.getDeliveryMode() == DeliveryMode.NON_PERSISTENT)
targetStore = volatileStore;
else
{
targetStore = persistentStore;
if (requiresTransactionalUpdate())
pendingChanges = true;
}
synchronized (storeLock)
{
targetStore.delete(lockRef.getHandle());
}
} | [
"public",
"void",
"removeLocked",
"(",
"MessageLock",
"lockRef",
")",
"throws",
"JMSException",
"{",
"checkTransactionLock",
"(",
")",
";",
"MessageStore",
"targetStore",
";",
"if",
"(",
"lockRef",
".",
"getDeliveryMode",
"(",
")",
"==",
"DeliveryMode",
".",
"NO... | Remove a locked message from this queue. The message is deleted from the underlying store. | [
"Remove",
"a",
"locked",
"message",
"from",
"this",
"queue",
".",
"The",
"message",
"is",
"deleted",
"from",
"the",
"underlying",
"store",
"."
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java#L235-L253 |
9,479 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java | LocalQueue.browse | public AbstractMessage browse( LocalQueueBrowserCursor cursor , MessageSelector selector ) throws JMSException
{
// Reset cursor to last known position
cursor.reset();
// Search in volatile store first
if (volatileStore != null)
{
AbstractMessage msg = browseStore(volatileStore, cursor, selector);
if (msg != null)
{
cursor.move();
return msg;
}
}
// Then in persistent store
if (persistentStore != null)
{
AbstractMessage msg = browseStore(persistentStore, cursor, selector);
if (msg != null)
{
cursor.move();
return msg;
}
}
// Nothing found, set EOQ flag on cursor
cursor.setEndOfQueueReached();
return null;
} | java | public AbstractMessage browse( LocalQueueBrowserCursor cursor , MessageSelector selector ) throws JMSException
{
// Reset cursor to last known position
cursor.reset();
// Search in volatile store first
if (volatileStore != null)
{
AbstractMessage msg = browseStore(volatileStore, cursor, selector);
if (msg != null)
{
cursor.move();
return msg;
}
}
// Then in persistent store
if (persistentStore != null)
{
AbstractMessage msg = browseStore(persistentStore, cursor, selector);
if (msg != null)
{
cursor.move();
return msg;
}
}
// Nothing found, set EOQ flag on cursor
cursor.setEndOfQueueReached();
return null;
} | [
"public",
"AbstractMessage",
"browse",
"(",
"LocalQueueBrowserCursor",
"cursor",
",",
"MessageSelector",
"selector",
")",
"throws",
"JMSException",
"{",
"// Reset cursor to last known position",
"cursor",
".",
"reset",
"(",
")",
";",
"// Search in volatile store first",
"if... | Browse a message in this queue
@param cursor browser cursor
@param selector a message selector or null
@return a matching message or null
@throws JMSException on internal error | [
"Browse",
"a",
"message",
"in",
"this",
"queue"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java#L449-L480 |
9,480 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java | LocalQueue.purge | public void purge( MessageSelector selector ) throws JMSException
{
if (volatileStore != null)
purgeStore(volatileStore,selector);
if (persistentStore != null)
{
openTransaction();
try
{
purgeStore(persistentStore,selector);
commitChanges();
}
finally
{
closeTransaction();
}
}
} | java | public void purge( MessageSelector selector ) throws JMSException
{
if (volatileStore != null)
purgeStore(volatileStore,selector);
if (persistentStore != null)
{
openTransaction();
try
{
purgeStore(persistentStore,selector);
commitChanges();
}
finally
{
closeTransaction();
}
}
} | [
"public",
"void",
"purge",
"(",
"MessageSelector",
"selector",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"volatileStore",
"!=",
"null",
")",
"purgeStore",
"(",
"volatileStore",
",",
"selector",
")",
";",
"if",
"(",
"persistentStore",
"!=",
"null",
")",
... | Purge some messages from the buffer | [
"Purge",
"some",
"messages",
"from",
"the",
"buffer"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java#L656-L673 |
9,481 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java | LocalQueue.notifyConsumer | private void notifyConsumer( AbstractMessage message )
{
consumersLock.readLock().lock();
try
{
switch (localConsumers.size())
{
case 0 : return; // Nobody's listening
case 1 :
notifySingleConsumer(localConsumers.get(0),message);
break;
default : // Multiple consumers
notifyNextConsumer(localConsumers,message);
break;
}
}
finally
{
consumersLock.readLock().unlock();
}
} | java | private void notifyConsumer( AbstractMessage message )
{
consumersLock.readLock().lock();
try
{
switch (localConsumers.size())
{
case 0 : return; // Nobody's listening
case 1 :
notifySingleConsumer(localConsumers.get(0),message);
break;
default : // Multiple consumers
notifyNextConsumer(localConsumers,message);
break;
}
}
finally
{
consumersLock.readLock().unlock();
}
} | [
"private",
"void",
"notifyConsumer",
"(",
"AbstractMessage",
"message",
")",
"{",
"consumersLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"switch",
"(",
"localConsumers",
".",
"size",
"(",
")",
")",
"{",
"case",
"0",
":",
"r... | Notify a consumer that a message is probably available for it to retrieve | [
"Notify",
"a",
"consumer",
"that",
"a",
"message",
"is",
"probably",
"available",
"for",
"it",
"to",
"retrieve"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/destination/LocalQueue.java#L706-L726 |
9,482 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaMessageStream.java | SagaMessageStream.timeoutHasExpired | private void timeoutHasExpired(final Timeout timeout, final TimeoutExpirationContext context) {
try {
addMessage(timeout, context.getOriginalHeaders());
} catch (Exception ex) {
LOG.error("Error handling timeout {}", timeout, ex);
}
} | java | private void timeoutHasExpired(final Timeout timeout, final TimeoutExpirationContext context) {
try {
addMessage(timeout, context.getOriginalHeaders());
} catch (Exception ex) {
LOG.error("Error handling timeout {}", timeout, ex);
}
} | [
"private",
"void",
"timeoutHasExpired",
"(",
"final",
"Timeout",
"timeout",
",",
"final",
"TimeoutExpirationContext",
"context",
")",
"{",
"try",
"{",
"addMessage",
"(",
"timeout",
",",
"context",
".",
"getOriginalHeaders",
"(",
")",
")",
";",
"}",
"catch",
"(... | Called whenever the timeout manager reports an expired timeout. | [
"Called",
"whenever",
"the",
"timeout",
"manager",
"reports",
"an",
"expired",
"timeout",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaMessageStream.java#L169-L175 |
9,483 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/startup/AnnotationSagaAnalyzer.java | AnnotationSagaAnalyzer.populateSagaHandlers | private void populateSagaHandlers() {
synchronized (sync) {
if (scanResult == null) {
scanResult = new HashMap<>();
Collection<Class<? extends Saga>> sagaTypes = scanner.scanForSagas();
for (Class<? extends Saga> sagaType : sagaTypes) {
SagaHandlersMap messageHandlers = determineMessageHandlers(sagaType);
scanResult.put(sagaType, messageHandlers);
}
}
}
} | java | private void populateSagaHandlers() {
synchronized (sync) {
if (scanResult == null) {
scanResult = new HashMap<>();
Collection<Class<? extends Saga>> sagaTypes = scanner.scanForSagas();
for (Class<? extends Saga> sagaType : sagaTypes) {
SagaHandlersMap messageHandlers = determineMessageHandlers(sagaType);
scanResult.put(sagaType, messageHandlers);
}
}
}
} | [
"private",
"void",
"populateSagaHandlers",
"(",
")",
"{",
"synchronized",
"(",
"sync",
")",
"{",
"if",
"(",
"scanResult",
"==",
"null",
")",
"{",
"scanResult",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
... | Creates entries in the scan result map containing the messages handlers
of the sagas provided by the injected scanner. | [
"Creates",
"entries",
"in",
"the",
"scan",
"result",
"map",
"containing",
"the",
"messages",
"handlers",
"of",
"the",
"sagas",
"provided",
"by",
"the",
"injected",
"scanner",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/startup/AnnotationSagaAnalyzer.java#L93-L105 |
9,484 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/startup/AnnotationSagaAnalyzer.java | AnnotationSagaAnalyzer.determineMessageHandlers | private SagaHandlersMap determineMessageHandlers(final Class<? extends Saga> sagaType) {
SagaHandlersMap handlerMap = new SagaHandlersMap(sagaType);
Method[] methods = sagaType.getMethods();
for (Method method : methods) {
if (isHandlerMethod(method)) {
// method matches expected handler signature -> add to handler map
Class<?> handlerType = method.getParameterTypes()[0];
boolean isSagaStart = hasStartSagaAnnotation(method);
handlerMap.add(MessageHandler.reflectionInvokedHandler(handlerType, method, isSagaStart));
}
}
return handlerMap;
} | java | private SagaHandlersMap determineMessageHandlers(final Class<? extends Saga> sagaType) {
SagaHandlersMap handlerMap = new SagaHandlersMap(sagaType);
Method[] methods = sagaType.getMethods();
for (Method method : methods) {
if (isHandlerMethod(method)) {
// method matches expected handler signature -> add to handler map
Class<?> handlerType = method.getParameterTypes()[0];
boolean isSagaStart = hasStartSagaAnnotation(method);
handlerMap.add(MessageHandler.reflectionInvokedHandler(handlerType, method, isSagaStart));
}
}
return handlerMap;
} | [
"private",
"SagaHandlersMap",
"determineMessageHandlers",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"sagaType",
")",
"{",
"SagaHandlersMap",
"handlerMap",
"=",
"new",
"SagaHandlersMap",
"(",
"sagaType",
")",
";",
"Method",
"[",
"]",
"methods",
"="... | Checks all methods for saga annotations. | [
"Checks",
"all",
"methods",
"for",
"saga",
"annotations",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/startup/AnnotationSagaAnalyzer.java#L110-L125 |
9,485 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/startup/AnnotationSagaAnalyzer.java | AnnotationSagaAnalyzer.isHandlerMethod | private boolean isHandlerMethod(final Method method) {
boolean isHandler = false;
if (hasStartSagaAnnotation(method) || hasHandlerAnnotation(method)) {
if (method.getReturnType().equals(Void.TYPE)) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length == 1) {
isHandler = true;
} else {
LOG.warn("Method {}.{} marked for saga does not have the expected single parameter.", method.getDeclaringClass(), method.getName());
}
} else {
LOG.warn("Method {}.{} marked for saga event handling but does return a value.", method.getDeclaringClass(), method.getName());
}
}
return isHandler;
} | java | private boolean isHandlerMethod(final Method method) {
boolean isHandler = false;
if (hasStartSagaAnnotation(method) || hasHandlerAnnotation(method)) {
if (method.getReturnType().equals(Void.TYPE)) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length == 1) {
isHandler = true;
} else {
LOG.warn("Method {}.{} marked for saga does not have the expected single parameter.", method.getDeclaringClass(), method.getName());
}
} else {
LOG.warn("Method {}.{} marked for saga event handling but does return a value.", method.getDeclaringClass(), method.getName());
}
}
return isHandler;
} | [
"private",
"boolean",
"isHandlerMethod",
"(",
"final",
"Method",
"method",
")",
"{",
"boolean",
"isHandler",
"=",
"false",
";",
"if",
"(",
"hasStartSagaAnnotation",
"(",
"method",
")",
"||",
"hasHandlerAnnotation",
"(",
"method",
")",
")",
"{",
"if",
"(",
"m... | Checks whether method has expected annotation arguments as well as signature. | [
"Checks",
"whether",
"method",
"has",
"expected",
"annotation",
"arguments",
"as",
"well",
"as",
"signature",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/startup/AnnotationSagaAnalyzer.java#L130-L147 |
9,486 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalQueue.java | JournalQueue.addLast | public void addLast( AbstractJournalOperation op )
{
if (tail == null)
{
head = tail = op;
}
else
{
tail.setNext(op);
tail = op;
}
op.setNext(null);
size++;
} | java | public void addLast( AbstractJournalOperation op )
{
if (tail == null)
{
head = tail = op;
}
else
{
tail.setNext(op);
tail = op;
}
op.setNext(null);
size++;
} | [
"public",
"void",
"addLast",
"(",
"AbstractJournalOperation",
"op",
")",
"{",
"if",
"(",
"tail",
"==",
"null",
")",
"{",
"head",
"=",
"tail",
"=",
"op",
";",
"}",
"else",
"{",
"tail",
".",
"setNext",
"(",
"op",
")",
";",
"tail",
"=",
"op",
";",
"... | Append an operation at the end of the queue
@param op a journal operation | [
"Append",
"an",
"operation",
"at",
"the",
"end",
"of",
"the",
"queue"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalQueue.java#L45-L59 |
9,487 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalQueue.java | JournalQueue.removeFirst | public AbstractJournalOperation removeFirst()
{
AbstractJournalOperation op = head;
if (op == null)
throw new NoSuchElementException();
head = op.next();
if (head == null)
tail = null;
op.setNext(null);
size--;
return op;
} | java | public AbstractJournalOperation removeFirst()
{
AbstractJournalOperation op = head;
if (op == null)
throw new NoSuchElementException();
head = op.next();
if (head == null)
tail = null;
op.setNext(null);
size--;
return op;
} | [
"public",
"AbstractJournalOperation",
"removeFirst",
"(",
")",
"{",
"AbstractJournalOperation",
"op",
"=",
"head",
";",
"if",
"(",
"op",
"==",
"null",
")",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"head",
"=",
"op",
".",
"next",
"(",
")",
"... | Remove the first available journal operation in queue
@return a journal operation
@throws NoSuchElementException if queue is empty | [
"Remove",
"the",
"first",
"available",
"journal",
"operation",
"in",
"queue"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalQueue.java#L66-L79 |
9,488 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalQueue.java | JournalQueue.migrateTo | public void migrateTo( JournalQueue otherQueue )
{
if (head == null)
return; // Empty
if (otherQueue.head == null)
{
// Other queue was empty, copy everything
otherQueue.head = head;
otherQueue.tail = tail;
otherQueue.size = size;
}
else
{
// Other queue is not empty, append operations
otherQueue.tail.setNext(head);
otherQueue.tail = tail;
otherQueue.size += size;
}
// Clear this queue
head = tail = null;
size = 0;
} | java | public void migrateTo( JournalQueue otherQueue )
{
if (head == null)
return; // Empty
if (otherQueue.head == null)
{
// Other queue was empty, copy everything
otherQueue.head = head;
otherQueue.tail = tail;
otherQueue.size = size;
}
else
{
// Other queue is not empty, append operations
otherQueue.tail.setNext(head);
otherQueue.tail = tail;
otherQueue.size += size;
}
// Clear this queue
head = tail = null;
size = 0;
} | [
"public",
"void",
"migrateTo",
"(",
"JournalQueue",
"otherQueue",
")",
"{",
"if",
"(",
"head",
"==",
"null",
")",
"return",
";",
"// Empty",
"if",
"(",
"otherQueue",
".",
"head",
"==",
"null",
")",
"{",
"// Other queue was empty, copy everything",
"otherQueue",
... | Migrate all operations to the given target queue
@param otherQueue target journal queue | [
"Migrate",
"all",
"operations",
"to",
"the",
"given",
"target",
"queue"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/journal/JournalQueue.java#L85-L108 |
9,489 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaInstanceCreator.java | SagaInstanceCreator.createNew | public Saga createNew(final Class<? extends Saga> sagaType) throws ExecutionException {
Saga newInstance = createNewInstance(sagaType);
if (newInstance instanceof NeedTimeouts) {
((NeedTimeouts) newInstance).setTimeoutManager(timeoutManager);
}
return newInstance;
} | java | public Saga createNew(final Class<? extends Saga> sagaType) throws ExecutionException {
Saga newInstance = createNewInstance(sagaType);
if (newInstance instanceof NeedTimeouts) {
((NeedTimeouts) newInstance).setTimeoutManager(timeoutManager);
}
return newInstance;
} | [
"public",
"Saga",
"createNew",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"sagaType",
")",
"throws",
"ExecutionException",
"{",
"Saga",
"newInstance",
"=",
"createNewInstance",
"(",
"sagaType",
")",
";",
"if",
"(",
"newInstance",
"instanceof",
"N... | Creates a new saga instances with the requested type.
@throws ExecutionException Is thrown in case no provider can be found to create an instance.
The actual cause can be inspected by {@link ExecutionException#getCause()}. | [
"Creates",
"a",
"new",
"saga",
"instances",
"with",
"the",
"requested",
"type",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaInstanceCreator.java#L52-L59 |
9,490 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/SerializationTools.java | SerializationTools.toByteArray | public static byte[] toByteArray( Serializable object )
{
try
{
ByteArrayOutputStream buf = new ByteArrayOutputStream(1024);
ObjectOutputStream objOut = new ObjectOutputStream(buf);
objOut.writeObject(object);
objOut.close();
return buf.toByteArray();
}
catch (IOException e)
{
throw new IllegalArgumentException("Cannot serialize object : "+e.toString());
}
} | java | public static byte[] toByteArray( Serializable object )
{
try
{
ByteArrayOutputStream buf = new ByteArrayOutputStream(1024);
ObjectOutputStream objOut = new ObjectOutputStream(buf);
objOut.writeObject(object);
objOut.close();
return buf.toByteArray();
}
catch (IOException e)
{
throw new IllegalArgumentException("Cannot serialize object : "+e.toString());
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"Serializable",
"object",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"buf",
"=",
"new",
"ByteArrayOutputStream",
"(",
"1024",
")",
";",
"ObjectOutputStream",
"objOut",
"=",
"new",
"ObjectOutputStream",
... | Object to byte array | [
"Object",
"to",
"byte",
"array"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/SerializationTools.java#L36-L50 |
9,491 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/utils/SerializationTools.java | SerializationTools.fromByteArray | public static Serializable fromByteArray( byte[] data )
{
try
{
ByteArrayInputStream buf = new ByteArrayInputStream(data);
ObjectInputStream objIn = new ObjectInputStream(buf);
Serializable response = (Serializable)objIn.readObject();
objIn.close();
return response;
}
catch (Exception e)
{
throw new IllegalArgumentException("Cannot deserialize object : "+e.toString());
}
} | java | public static Serializable fromByteArray( byte[] data )
{
try
{
ByteArrayInputStream buf = new ByteArrayInputStream(data);
ObjectInputStream objIn = new ObjectInputStream(buf);
Serializable response = (Serializable)objIn.readObject();
objIn.close();
return response;
}
catch (Exception e)
{
throw new IllegalArgumentException("Cannot deserialize object : "+e.toString());
}
} | [
"public",
"static",
"Serializable",
"fromByteArray",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"try",
"{",
"ByteArrayInputStream",
"buf",
"=",
"new",
"ByteArrayInputStream",
"(",
"data",
")",
";",
"ObjectInputStream",
"objIn",
"=",
"new",
"ObjectInputStream",
"("... | Byte array to object | [
"Byte",
"array",
"to",
"object"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/SerializationTools.java#L55-L69 |
9,492 | timewalker74/ffmq | server/src/main/java/net/timewalker/ffmq4/listeners/tcp/io/TcpListener.java | TcpListener.createProcessor | protected ClientProcessor createProcessor( String clientId , Socket clientSocket ) throws PacketTransportException
{
PacketTransport transport = new TcpPacketTransport(clientId,clientSocket,settings);
ClientProcessor clientProcessor = new ClientProcessor(clientId,this,localEngine,transport);
return clientProcessor;
} | java | protected ClientProcessor createProcessor( String clientId , Socket clientSocket ) throws PacketTransportException
{
PacketTransport transport = new TcpPacketTransport(clientId,clientSocket,settings);
ClientProcessor clientProcessor = new ClientProcessor(clientId,this,localEngine,transport);
return clientProcessor;
} | [
"protected",
"ClientProcessor",
"createProcessor",
"(",
"String",
"clientId",
",",
"Socket",
"clientSocket",
")",
"throws",
"PacketTransportException",
"{",
"PacketTransport",
"transport",
"=",
"new",
"TcpPacketTransport",
"(",
"clientId",
",",
"clientSocket",
",",
"set... | Create a new processor | [
"Create",
"a",
"new",
"processor"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/server/src/main/java/net/timewalker/ffmq4/listeners/tcp/io/TcpListener.java#L220-L225 |
9,493 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaExecutionTask.java | SagaExecutionTask.updateStateStorage | private void updateStateStorage(final SagaInstanceInfo description, final CurrentExecutionContext context) {
Saga saga = description.getSaga();
String sagaId = saga.state().getSagaId();
// if saga has finished delete existing state and possible timeouts
// if saga has just been created state has never been save and there
// is no need to delete it.
if (saga.isFinished() && !description.isStarting()) {
cleanupSagaSate(sagaId);
} else if (saga.isFinished() && description.isStarting()) {
// check storage on whether saga has been saved via
// a recursive child contexts.
if (context.hasBeenStored(sagaId)) {
cleanupSagaSate(sagaId);
}
}
if (!saga.isFinished()) {
context.recordSagaStateStored(sagaId);
env.storage().save(saga.state());
}
} | java | private void updateStateStorage(final SagaInstanceInfo description, final CurrentExecutionContext context) {
Saga saga = description.getSaga();
String sagaId = saga.state().getSagaId();
// if saga has finished delete existing state and possible timeouts
// if saga has just been created state has never been save and there
// is no need to delete it.
if (saga.isFinished() && !description.isStarting()) {
cleanupSagaSate(sagaId);
} else if (saga.isFinished() && description.isStarting()) {
// check storage on whether saga has been saved via
// a recursive child contexts.
if (context.hasBeenStored(sagaId)) {
cleanupSagaSate(sagaId);
}
}
if (!saga.isFinished()) {
context.recordSagaStateStored(sagaId);
env.storage().save(saga.state());
}
} | [
"private",
"void",
"updateStateStorage",
"(",
"final",
"SagaInstanceInfo",
"description",
",",
"final",
"CurrentExecutionContext",
"context",
")",
"{",
"Saga",
"saga",
"=",
"description",
".",
"getSaga",
"(",
")",
";",
"String",
"sagaId",
"=",
"saga",
".",
"stat... | Updates the state storage depending on whether the saga is completed or keeps on running. | [
"Updates",
"the",
"state",
"storage",
"depending",
"on",
"whether",
"the",
"saga",
"is",
"completed",
"or",
"keeps",
"on",
"running",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaExecutionTask.java#L201-L222 |
9,494 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/management/destination/template/TopicTemplate.java | TopicTemplate.createTopicDefinition | public TopicDefinition createTopicDefinition( String topicName , boolean temporary )
{
TopicDefinition def = new TopicDefinition();
def.setName(topicName);
def.setTemporary(temporary);
copyAttributesTo(def);
def.setSubscriberFailurePolicy(subscriberFailurePolicy);
def.setSubscriberOverflowPolicy(subscriberOverflowPolicy);
def.setPartitionsKeysToIndex(partitionsKeysToIndex);
return def;
} | java | public TopicDefinition createTopicDefinition( String topicName , boolean temporary )
{
TopicDefinition def = new TopicDefinition();
def.setName(topicName);
def.setTemporary(temporary);
copyAttributesTo(def);
def.setSubscriberFailurePolicy(subscriberFailurePolicy);
def.setSubscriberOverflowPolicy(subscriberOverflowPolicy);
def.setPartitionsKeysToIndex(partitionsKeysToIndex);
return def;
} | [
"public",
"TopicDefinition",
"createTopicDefinition",
"(",
"String",
"topicName",
",",
"boolean",
"temporary",
")",
"{",
"TopicDefinition",
"def",
"=",
"new",
"TopicDefinition",
"(",
")",
";",
"def",
".",
"setName",
"(",
"topicName",
")",
";",
"def",
".",
"set... | Create a topic definition from this template | [
"Create",
"a",
"topic",
"definition",
"from",
"this",
"template"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/management/destination/template/TopicTemplate.java#L144-L155 |
9,495 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/transport/PacketTransportHub.java | PacketTransportHub.createEndpoint | public synchronized PacketTransportEndpoint createEndpoint() throws JMSException
{
if (closed || transport.isClosed())
throw new FFMQException("Transport is closed", "TRANSPORT_CLOSED");
PacketTransportEndpoint endpoint = new PacketTransportEndpoint(nextEndpointId++, this);
registeredEndpoints.put(Integer.valueOf(endpoint.getId()), endpoint);
return endpoint;
} | java | public synchronized PacketTransportEndpoint createEndpoint() throws JMSException
{
if (closed || transport.isClosed())
throw new FFMQException("Transport is closed", "TRANSPORT_CLOSED");
PacketTransportEndpoint endpoint = new PacketTransportEndpoint(nextEndpointId++, this);
registeredEndpoints.put(Integer.valueOf(endpoint.getId()), endpoint);
return endpoint;
} | [
"public",
"synchronized",
"PacketTransportEndpoint",
"createEndpoint",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"closed",
"||",
"transport",
".",
"isClosed",
"(",
")",
")",
"throw",
"new",
"FFMQException",
"(",
"\"Transport is closed\"",
",",
"\"TRANSPORT... | Create a new transport endpoint
@return a new transport endpoint | [
"Create",
"a",
"new",
"transport",
"endpoint"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/transport/PacketTransportHub.java#L42-L50 |
9,496 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/StringUtils.java | StringUtils.replaceDoubleSingleQuotes | public static String replaceDoubleSingleQuotes( String value )
{
int idx = value.indexOf("''");
if (idx == -1)
return value;
int len = value.length();
int pos = 0;
StringBuilder sb = new StringBuilder(len);
while (idx != -1)
{
if (idx > pos)
{
sb.append(value.substring(pos, idx));
pos += (idx-pos);
}
sb.append("'");
pos+=2;
idx = value.indexOf("''",pos);
}
if (pos < len)
sb.append(value.substring(pos, len));
return sb.toString();
} | java | public static String replaceDoubleSingleQuotes( String value )
{
int idx = value.indexOf("''");
if (idx == -1)
return value;
int len = value.length();
int pos = 0;
StringBuilder sb = new StringBuilder(len);
while (idx != -1)
{
if (idx > pos)
{
sb.append(value.substring(pos, idx));
pos += (idx-pos);
}
sb.append("'");
pos+=2;
idx = value.indexOf("''",pos);
}
if (pos < len)
sb.append(value.substring(pos, len));
return sb.toString();
} | [
"public",
"static",
"String",
"replaceDoubleSingleQuotes",
"(",
"String",
"value",
")",
"{",
"int",
"idx",
"=",
"value",
".",
"indexOf",
"(",
"\"''\"",
")",
";",
"if",
"(",
"idx",
"==",
"-",
"1",
")",
"return",
"value",
";",
"int",
"len",
"=",
"value",... | Replace double single quotes in the target string | [
"Replace",
"double",
"single",
"quotes",
"in",
"the",
"target",
"string"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/StringUtils.java#L33-L59 |
9,497 | timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/StringUtils.java | StringUtils.parseNumber | public static Number parseNumber( String numberAsString ) throws InvalidSelectorException
{
if (numberAsString == null) return null;
try
{
if (numberAsString.indexOf('.') != -1 ||
numberAsString.indexOf('e') != -1 ||
numberAsString.indexOf('E') != -1)
{
return new Double(numberAsString);
}
else
return Long.valueOf(numberAsString);
}
catch (NumberFormatException e)
{
throw new InvalidSelectorException("Invalid numeric value : "+numberAsString);
}
} | java | public static Number parseNumber( String numberAsString ) throws InvalidSelectorException
{
if (numberAsString == null) return null;
try
{
if (numberAsString.indexOf('.') != -1 ||
numberAsString.indexOf('e') != -1 ||
numberAsString.indexOf('E') != -1)
{
return new Double(numberAsString);
}
else
return Long.valueOf(numberAsString);
}
catch (NumberFormatException e)
{
throw new InvalidSelectorException("Invalid numeric value : "+numberAsString);
}
} | [
"public",
"static",
"Number",
"parseNumber",
"(",
"String",
"numberAsString",
")",
"throws",
"InvalidSelectorException",
"{",
"if",
"(",
"numberAsString",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"if",
"(",
"numberAsString",
".",
"indexOf",
"(",
"... | Parse a number as string | [
"Parse",
"a",
"number",
"as",
"string"
] | 638773ee29a4a5f9c6119ed74ad14ac9c46382b3 | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/common/message/selector/expression/utils/StringUtils.java#L95-L113 |
9,498 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaType.java | SagaType.startsNewSaga | public static SagaType startsNewSaga(final Class<? extends Saga> sagaClass) {
checkNotNull(sagaClass, "The type of the saga has to be defined.");
SagaType sagaType = new SagaType();
sagaType.startsNew = true;
sagaType.sagaClass = sagaClass;
return sagaType;
} | java | public static SagaType startsNewSaga(final Class<? extends Saga> sagaClass) {
checkNotNull(sagaClass, "The type of the saga has to be defined.");
SagaType sagaType = new SagaType();
sagaType.startsNew = true;
sagaType.sagaClass = sagaClass;
return sagaType;
} | [
"public",
"static",
"SagaType",
"startsNewSaga",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"sagaClass",
")",
"{",
"checkNotNull",
"(",
"sagaClass",
",",
"\"The type of the saga has to be defined.\"",
")",
";",
"SagaType",
"sagaType",
"=",
"new",
"Sa... | Creates a type indicating to start a complete new saga. | [
"Creates",
"a",
"type",
"indicating",
"to",
"start",
"a",
"complete",
"new",
"saga",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaType.java#L52-L60 |
9,499 | Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaType.java | SagaType.continueSaga | public static SagaType continueSaga(final Class<? extends Saga> sagaClass) {
checkNotNull(sagaClass, "The type of the saga has to be defined.");
SagaType sagaType = new SagaType();
sagaType.startsNew = false;
sagaType.sagaClass = sagaClass;
return sagaType;
} | java | public static SagaType continueSaga(final Class<? extends Saga> sagaClass) {
checkNotNull(sagaClass, "The type of the saga has to be defined.");
SagaType sagaType = new SagaType();
sagaType.startsNew = false;
sagaType.sagaClass = sagaClass;
return sagaType;
} | [
"public",
"static",
"SagaType",
"continueSaga",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Saga",
">",
"sagaClass",
")",
"{",
"checkNotNull",
"(",
"sagaClass",
",",
"\"The type of the saga has to be defined.\"",
")",
";",
"SagaType",
"sagaType",
"=",
"new",
"Sag... | Creates a type continuing a saga with an instance key that has yet to be defined. | [
"Creates",
"a",
"type",
"continuing",
"a",
"saga",
"with",
"an",
"instance",
"key",
"that",
"has",
"yet",
"to",
"be",
"defined",
"."
] | c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaType.java#L65-L73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.