code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Override public String toString() { return getClass().getSimpleName() + "{" + "name='" + name + '\'' + '}'; }
Base class for management related commands.
toString
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/ManagementRegistrar.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/ManagementRegistrar.java
Apache-2.0
public static long currentTimeMillis() { long now = System.currentTimeMillis(); long time = lastTime.get(); if (now > time) { lastTime.compareAndSet(time, now); return lastTime.get(); } return time; }
Return the current time in milliseconds, guaranteeing monotonic time increment. @return the current time in milliseconds.
currentTimeMillis
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/MonotonicClock.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/MonotonicClock.java
Apache-2.0
public static void setProperty(Object target, String propertyName, Object propertyValue) throws PropertyException { String[] propertyNames = propertyName.split("\\."); StringBuilder visitedPropertyName = new StringBuilder(); Object currentTarget = target; Object parentTarget = target; ...
Set a direct or indirect property (dotted property: prop1.prop2.prop3) on the target object. This method tries to be smart in the way that intermediate properties currently set to null are set if it is possible to create and set an object. Conversions from propertyValue to the proper destination type are performed when...
setProperty
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
public static Map<String, Object> getProperties(Object target) throws PropertyException { Map<String, Object> properties = new HashMap<String, Object>(); Class<?> clazz = target.getClass(); Method[] methods = clazz.getMethods(); for (Method method : methods) { String name = m...
Build a map of direct javabeans properties of the target object. Only read/write properties (ie: those who have both a getter and a setter) are returned. @param target the target object from which to get properties names. @return a Map of String with properties names as key and their values @throws PropertyException if...
getProperties
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static boolean containsSetterForGetter(Class<?> clazz, Method method) { String methodName = method.getName(); String setterName; if (methodName.startsWith("get")) { setterName = "set" + methodName.substring(3); } else if (methodName.startsWith("is")) { se...
Build a map of direct javabeans properties of the target object. Only read/write properties (ie: those who have both a getter and a setter) are returned. @param target the target object from which to get properties names. @return a Map of String with properties names as key and their values @throws PropertyException if...
containsSetterForGetter
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
public static Object getProperty(Object target, String propertyName) throws PropertyException { String[] propertyNames = propertyName.split("\\."); Object currentTarget = target; for (int i = 0; i < propertyNames.length; i++) { String name = propertyNames[i]; Object resul...
Get a direct or indirect property (dotted property: prop1.prop2.prop3) on the target object. @param target the target object from which to get the property. @param propertyName the name of the property to get. @return the value of the specified property. @throws PropertyException if an error happened while trying to ge...
getProperty
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
public static void setProperties(Object target, Map<String, Object> properties) throws PropertyException { for (Map.Entry<String, Object> entry : properties.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); setProperty(target, name, value); ...
Set a {@link Map} of direct or indirect properties on the target object. @param target the target object on which to set the properties. @param properties a {@link Map} of String/Object pairs. @throws PropertyException if an error happened while trying to set a property.
setProperties
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
public static String propertiesToString(Object obj) { StringBuilder sb = new StringBuilder(); Map<String, Object> properties = new TreeMap<String, Object>(getProperties(obj)); Iterator<String> it = properties.keySet().iterator(); while (it.hasNext()) { String property = it.ne...
Return a comma-separated String of r/w properties of the specified object. @param obj the object to introspect. @return a a comma-separated String of r/w properties.
propertiesToString
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static void setDirectProperty(Object target, String propertyName, Object propertyValue) throws PropertyException { Method setter = getSetter(target, propertyName); Class<?> parameterType = setter.getParameterTypes()[0]; try { if (propertyValue != null) { Objec...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
setDirectProperty
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static Map<String, Object> getNestedProperties(String prefix, Map<String, Object> properties) { Map<String, Object> result = new HashMap<String, Object>(); for (Map.Entry<String, Object> entry : properties.entrySet()) { String name = entry.getKey(); String value = (String...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
getNestedProperties
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static Object transform(Object value, Class<?> destinationClass) { if (value.getClass() == destinationClass) { return value; } if ( value.getClass() == boolean.class || value.getClass() == Boolean.class || value.getClass() == byte.class || value.getClass()...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
transform
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static void callSetter(Object target, String propertyName, Object parameter) throws PropertyException { Method setter = getSetter(target, propertyName); try { setter.invoke(target, parameter); } catch (IllegalAccessException ex) { throw new PropertyException("prop...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
callSetter
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static Object callGetter(Object target, String propertyName) throws PropertyException { Method getter = getGetter(target, propertyName); try { return getter.invoke(target); } catch (IllegalAccessException ex) { throw new PropertyException("property '" + propertyNa...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
callGetter
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static Method getSetter(Object target, String propertyName) { if (propertyName == null || "".equals(propertyName)) { throw new PropertyException("encountered invalid null or empty property name"); } String setterName = "set" + propertyName.substring(0, 1).toUpperCase() + prop...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
getSetter
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static Method getGetter(Object target, String propertyName) { String getterName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); String getterIsName = "is" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
getGetter
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
private static Class<?> getPropertyType(Object target, String propertyName) { String getterName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); String getterIsName = "is" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods ...
Set a direct property on the target object. Conversions from propertyValue to the proper destination type are performed whenever possible. @param target the target object on which to set the property. @param propertyName the name of the property to set. @param propertyValue the value of the property to set. @throws Pro...
getPropertyType
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/PropertyUtils.java
Apache-2.0
public synchronized void add(T obj, Integer position) { List<T> list = objects.get(position); if (list == null) { if (!keys.contains(position)) { keys.add(position); Collections.sort(keys); } list = new ArrayList<T>(); objec...
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
add
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public synchronized void remove(T obj) { Iterator<T> it = iterator(); while (it.hasNext()) { T o = it.next(); if (o == obj) { it.remove(); return; } } throw new NoSuchElementException("no such element: " + obj); }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
remove
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public synchronized SortedSet<Integer> getNaturalOrderPositions() { return new TreeSet<Integer>(objects.keySet()); }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
getNaturalOrderPositions
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public synchronized SortedSet<Integer> getReverseOrderPositions() { TreeSet<Integer> result = new TreeSet<Integer>(Collections.reverseOrder()); result.addAll(getNaturalOrderPositions()); return result; }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
getReverseOrderPositions
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public synchronized List<T> getByNaturalOrderForPosition(Integer position) { return objects.get(position); }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
getByNaturalOrderForPosition
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public synchronized List<T> getByReverseOrderForPosition(Integer position) { List<T> result = new ArrayList<T>(getByNaturalOrderForPosition(position)); Collections.reverse(result); return result; }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
getByReverseOrderForPosition
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public synchronized int size() { return size; }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
size
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public Iterator<T> iterator() { return new SchedulerNaturalOrderIterator(); }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
iterator
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public Iterator<T> reverseIterator() { return new SchedulerReverseOrderIterator(); }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
reverseIterator
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public String toString() { return "a Scheduler with " + size() + " object(s) in " + getNaturalOrderPositions().size() + " position(s)"; }
Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration. @author Ludovic Orban @param <T> th...
toString
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public void remove() { synchronized (Scheduler.this) { if (objectsOfCurrentKey == null) throw new NoSuchElementException("iterator not yet placed on an element"); objectsOfCurrentKeyIndex--; objectsOfCurrentKey.remove(obj...
This iterator supports in-flight updates of the iterated object.
remove
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public boolean hasNext() { synchronized (Scheduler.this) { if (objectsOfCurrentKey == null || objectsOfCurrentKeyIndex >= objectsOfCurrentKey.size()) { // we reached the end of the current position's list if (nextKeyIndex < Scheduler...
This iterator supports in-flight updates of the iterated object.
hasNext
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public T next() { synchronized (Scheduler.this) { if (!hasNext()) throw new NoSuchElementException("iterator bounds reached"); return objectsOfCurrentKey.get(objectsOfCurrentKeyIndex++); } }
This iterator supports in-flight updates of the iterated object.
next
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public void remove() { synchronized (Scheduler.this) { if (objectsOfCurrentKey == null) throw new NoSuchElementException("iterator not yet placed on an element"); objectsOfCurrentKeyIndex--; objectsOfCurrentKey.remove(obj...
This iterator supports in-flight updates of the iterated object.
remove
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public boolean hasNext() { synchronized (Scheduler.this) { if (objectsOfCurrentKey == null || objectsOfCurrentKeyIndex >= objectsOfCurrentKey.size()) { // we reached the end of the current position's list if (nextKeyIndex >= 0) { ...
This iterator supports in-flight updates of the iterated object.
hasNext
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
@Override public T next() { synchronized (Scheduler.this) { if (!hasNext()) throw new NoSuchElementException("iterator bounds reached"); return objectsOfCurrentKey.get(objectsOfCurrentKeyIndex++); } }
This iterator supports in-flight updates of the iterated object.
next
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Scheduler.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Scheduler.java
Apache-2.0
public byte[] getArray() { return array; }
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
getArray
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
public byte[] extractServerId() { int serverIdLength = array.length - 4 - 8; // - sequence - timestamp if (serverIdLength < 1) return null; byte[] result = new byte[serverIdLength]; System.arraycopy(array, 0, result, 0, serverIdLength); return result; }
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
extractServerId
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
public long extractTimestamp() { return Encoder.bytesToLong(array, array.length - 4 - 8); // - sequence - timestamp }
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
extractTimestamp
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
public int extractSequence() { return Encoder.bytesToInt(array, array.length - 4); // - sequence }
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
extractSequence
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
public int length() { return array.length; }
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
length
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
@Override public boolean equals(Object obj) { if (obj instanceof Uid) { Uid otherUid = (Uid) obj; // optimizes performance a bit if (hashCodeValue != otherUid.hashCodeValue) return false; return Arrays.equals(array, otherUid.array); }...
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
equals
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
@Override public int hashCode() { return hashCodeValue; }
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
hashCode
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
@Override public String toString() { return toStringValue; }
<p>A constant UID byte array container optimized for use with hashed collections.</p> @author Ludovic Orban
toString
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
private static int arrayHashCode(byte[] uid) { int hash = 0; // Common fast but good hash with wide dispersion for (int i = uid.length - 1; i > 0; i--) { // rotate left and xor // (very fast in assembler, a bit clumsy in Java) hash <<= 1; if (hash...
Compute a UID byte array hashcode value. @param uid the byte array used for hashcode computation. @return a constant hash value for the specified uid.
arrayHashCode
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
private static String arrayToString(byte[] uid) { char[] hexChars = new char[uid.length * 2]; int c = 0; int v; for (int i = 0; i < uid.length; i++) { v = uid[i] & 0xFF; hexChars[c++] = HEX[v >> 4]; hexChars[c++] = HEX[v & 0xF]; } retur...
Decode a UID byte array into a (somewhat) human-readable hex string. @param uid the uid to decode. @return the resulting printable string.
arrayToString
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/Uid.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/Uid.java
Apache-2.0
public static Uid generateUid() { byte[] timestamp = Encoder.longToBytes(MonotonicClock.currentTimeMillis()); byte[] sequence = Encoder.intToBytes(sequenceGenerator.incrementAndGet()); byte[] serverId = TransactionManagerServices.getConfiguration().buildServerIdArray(); int uidLength = ...
Generate a UID, globally unique. This method relies on the configured serverId for network uniqueness. @return the generated UID.
generateUid
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/UidGenerator.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/UidGenerator.java
Apache-2.0
public static BitronixXid generateXid(Uid gtrid) { return new BitronixXid(gtrid, generateUid()); }
Generate a XID with the specified globalTransactionId. @param gtrid the GTRID to use to generate the Xid. @return the generated Xid.
generateXid
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/utils/UidGenerator.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/utils/UidGenerator.java
Apache-2.0
public void testRecoverPresumedAbort() throws Exception { byte[] gtrid = UidGenerator.generateUid().getArray(); xaResource.addInDoubtXid(new MockXid(0, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(1, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new Mo...
Create 3 XIDs on the resource that are not in the journal -> recoverer presumes they have aborted and rolls them back. @throws Exception
testRecoverPresumedAbort
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/recovery/RecovererTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/recovery/RecovererTest.java
Apache-2.0
public void testIncrementalRecoverPresumedAbort() throws Exception { byte[] gtrid = UidGenerator.generateUid().getArray(); xaResource.addInDoubtXid(new MockXid(0, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoubtXid(new MockXid(1, gtrid, BitronixXid.FORMAT_ID)); xaResource.addInDoub...
Create 3 XIDs on the resource that are not in the journal -> recoverer presumes they have aborted and rolls them back. @throws Exception
testIncrementalRecoverPresumedAbort
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/recovery/RecovererTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/recovery/RecovererTest.java
Apache-2.0
private XAResourceProducer createMockProducer(String uniqueName) throws RecoveryException { XAResourceProducer producer; producer = mock(XAResourceProducer.class); when(producer.getUniqueName()).thenReturn(uniqueName); ResourceBean resourceBean = mock(ResourceBean.class); when(r...
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
createMockProducer
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
private Future registerBlockingProducer(final XAResourceProducer producer, final CountDownLatch border) throws RecoveryException { final XAResourceHolderState resourceHolderState = producer.startRecovery(); when(producer.startRecovery()).thenAnswer(new Answer<Object>() { public Object answer...
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
registerBlockingProducer
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
public Object answer(InvocationOnMock invocation) throws Throwable { border.await(); return resourceHolderState; }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
answer
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
public Object call() throws Exception { ResourceRegistrar.register(producer); return null; }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
call
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Before public void setUp() throws Exception { executorService = Executors.newCachedThreadPool(); producer = createMockProducer("xa-rp"); ResourceRegistrar.register(producer); TransactionManagerServices.getTransactionManager(); }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
setUp
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@After public void tearDown() throws Exception { TransactionManagerServices.getTransactionManager().shutdown(); executorService.shutdown(); for (String name : ResourceRegistrar.getResourcesUniqueNames()) ResourceRegistrar.unregister(ResourceRegistrar.get(name)); }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
tearDown
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test public void testGet() throws Exception { assertSame(producer, ResourceRegistrar.get("xa-rp")); assertNull(ResourceRegistrar.get("non-existing")); assertNull(ResourceRegistrar.get(null)); }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testGet
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test public void testGetDoesNotReturnUninitializedProducers() throws Exception { CountDownLatch border = new CountDownLatch(1); Future future = registerBlockingProducer(createMockProducer("uninitialized"), border); assertNull(ResourceRegistrar.get("uninitialized")); border.countDow...
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testGetDoesNotReturnUninitializedProducers
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test public void testGetResourcesUniqueNames() throws Exception { assertArrayEquals(new Object[]{"xa-rp"}, ResourceRegistrar.getResourcesUniqueNames().toArray()); }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testGetResourcesUniqueNames
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test public void testGetResourcesUniqueNamesDoesNotReturnUninitializedProducers() throws Exception { CountDownLatch border = new CountDownLatch(1); Future future = registerBlockingProducer(createMockProducer("uninitialized"), border); assertArrayEquals(new Object[]{"xa-rp"}, ResourceRegist...
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testGetResourcesUniqueNamesDoesNotReturnUninitializedProducers
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test(expected = IllegalStateException.class) public void testCannotRegisterSameRPTwice() throws Exception { ResourceRegistrar.register(createMockProducer("xa-rp")); }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testCannotRegisterSameRPTwice
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test public void testNonRecoverableProducersAreNotRegistered() throws Exception { final XAResourceProducer producer = createMockProducer("non-recoverable"); when(producer.startRecovery()).thenThrow(new RecoveryException("recovery not possible")); try { ResourceRegistrar.registe...
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testNonRecoverableProducersAreNotRegistered
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test public void testUnregister() throws Exception { assertEquals(1, ResourceRegistrar.getResourcesUniqueNames().size()); ResourceRegistrar.unregister(createMockProducer("xa-rp")); assertEquals(0, ResourceRegistrar.getResourcesUniqueNames().size()); }
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testUnregister
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Test public void testFindXAResourceHolderDelegatesAndDoesNotCallUninitialized() throws Exception { final XAResource resource = mock(XAResource.class); final XAResourceProducer uninitializedProducer = createMockProducer("uninitialized"); CountDownLatch border = new CountDownLatch(1); ...
Tests the fundamental functionality of the newly implemented ResourceRegistrar. @author Juergen_Kellerer, 2011-08-24
testFindXAResourceHolderDelegatesAndDoesNotCallUninitialized
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/ResourceRegistrarTest.java
Apache-2.0
@Override public XAResource getXAResource() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getXAResource
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public void acceptVisitorForXAResourceHolderStates(Uid gtrid, XAResourceHolderStateVisitor visitor) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
acceptVisitorForXAResourceHolderStates
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public boolean isExistXAResourceHolderStatesForGtrid(Uid gtrid) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
isExistXAResourceHolderStatesForGtrid
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public int getXAResourceHolderStateCountForGtrid(Uid gtrid) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getXAResourceHolderStateCountForGtrid
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public void putXAResourceHolderState(BitronixXid xid, XAResourceHolderState xaResourceHolderState) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
putXAResourceHolderState
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public void removeXAResourceHolderState(BitronixXid xid) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
removeXAResourceHolderState
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public boolean hasStateForXAResource(XAResourceHolder<? extends XAResourceHolder> xaResourceHolder) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
hasStateForXAResource
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public ResourceBean getResourceBean() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getResourceBean
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public State getState() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getState
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public void setState(State state) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
setState
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public void addStateChangeEventListener(StateChangeListener<DummyResourceHolder> listener) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
addStateChangeEventListener
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public void removeStateChangeEventListener(StateChangeListener<DummyResourceHolder> listener) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
removeStateChangeEventListener
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public List<? extends XAResourceHolder<? extends XAResourceHolder>> getXAResourceHolders() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getXAResourceHolders
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public Object getConnectionHandle() throws Exception { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getConnectionHandle
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public void close() throws Exception { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
close
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public Date getLastReleaseDate() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getLastReleaseDate
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public Date getCreationDate() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XASResourceHolder class, to get the generics right. @author Chris Rankin
getCreationDate
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyResourceHolder.java
Apache-2.0
@Override public State getState() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
getState
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public void setState(State state) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
setState
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public void addStateChangeEventListener(StateChangeListener<DummyStatefulHolder> listener) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
addStateChangeEventListener
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public void removeStateChangeEventListener(StateChangeListener<DummyStatefulHolder> listener) { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
removeStateChangeEventListener
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public List<? extends XAResourceHolder<? extends XAResourceHolder>> getXAResourceHolders() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
getXAResourceHolders
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public Object getConnectionHandle() throws Exception { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
getConnectionHandle
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public void close() throws Exception { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
close
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public Date getLastReleaseDate() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
getLastReleaseDate
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
@Override public Date getCreationDate() { throw new UnsupportedOperationException("Not supported yet."); }
Dummy XAStatefulHolder class, to get the generics right. @author Chris Rankin
getCreationDate
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/resource/common/DummyStatefulHolder.java
Apache-2.0
public void testPrepareFailureRollbackFailure() throws Exception { tm.begin(); tm.setTransactionTimeout(10); // TX must not timeout Connection connection1 = poolingDataSource1.getConnection(); PooledConnectionProxy handle = (PooledConnectionProxy) connection1; XAConnection xaCon...
Test scenario: XAResources: 2 TX timeout: 10s TX resolution: rollback XAResource 1 resolution: rollback throws exception XAException.XAER_INVAL, exception fixed after 2s XAResource 2 resolution: prepare throws exception XAException.XAER_RMERR Expected outcome: TM fails on resource 2 prepare and throws RollbackExce...
testPrepareFailureRollbackFailure
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
Apache-2.0
public void testPrepareFailure() throws Exception { tm.begin(); tm.setTransactionTimeout(10); // TX must not timeout Connection connection1 = poolingDataSource1.getConnection(); connection1.createStatement(); Connection connection2 = poolingDataSource2.getConnection(); ...
Test scenario: XAResources: 3 TX timeout: 10s TX resolution: rollback @throws Exception if any error happens.
testPrepareFailure
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
Apache-2.0
public void testPrepareLrcFailure() throws Exception { tm.begin(); tm.setTransactionTimeout(10); // TX must not timeout Connection connection1 = poolingDataSource1.getConnection(); PooledConnectionProxy handle = (PooledConnectionProxy) connection1; XAConnection xaConnection1 = (...
Test scenario: XAResources: 2 TX timeout: 10s TX resolution: rollback XAResource 1 resolution: prepare throws exception XAException.XAER_RMERR XAResource 2 resolution: it's an LRCXaResource and prepare does not happen on this resource. Expected outcome: TM fails on resource 1 prepare and throws RollbackException. P...
testPrepareLrcFailure
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
Apache-2.0
@Override protected void setUp() throws Exception { EventRecorder.clear(); // change disk journal into mock journal Field field = TransactionManagerServices.class.getDeclaredField("journalRef"); field.setAccessible(true); @SuppressWarnings("unchecked") AtomicReferenc...
Test scenario: XAResources: 2 TX timeout: 10s TX resolution: rollback XAResource 1 resolution: prepare throws exception XAException.XAER_RMERR XAResource 2 resolution: it's an LRCXaResource and prepare does not happen on this resource. Expected outcome: TM fails on resource 1 prepare and throws RollbackException. P...
setUp
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
Apache-2.0
@Override protected void tearDown() throws Exception { poolingDataSource1.close(); poolingDataSource2.close(); poolingDataSource3.close(); poolingDataSourceLrc.close(); tm.shutdown(); }
Test scenario: XAResources: 2 TX timeout: 10s TX resolution: rollback XAResource 1 resolution: prepare throws exception XAException.XAER_RMERR XAResource 2 resolution: it's an LRCXaResource and prepare does not happen on this resource. Expected outcome: TM fails on resource 1 prepare and throws RollbackException. P...
tearDown
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
Apache-2.0
private XAException createXAException(String msg, int errorCode) { XAException prepareException = new XAException(msg); prepareException.errorCode = errorCode; return prepareException; }
Test scenario: XAResources: 2 TX timeout: 10s TX resolution: rollback XAResource 1 resolution: prepare throws exception XAException.XAER_RMERR XAResource 2 resolution: it's an LRCXaResource and prepare does not happen on this resource. Expected outcome: TM fails on resource 1 prepare and throws RollbackException. P...
createXAException
java
scalar-labs/btm
btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
https://github.com/scalar-labs/btm/blob/master/btm/src/test/java/bitronix/tm/twopc/Phase1FailureTest.java
Apache-2.0
@Override protected UserTransaction retrieveUserTransaction() throws TransactionSystemException { return transactionManager; }
Bitronix-specific Spring PlatformTransactionManager implementation. @author Marcus Klimstra (CGI)
retrieveUserTransaction
java
scalar-labs/btm
btm-spring/src/main/java/bitronix/tm/integration/spring/PlatformTransactionManager.java
https://github.com/scalar-labs/btm/blob/master/btm-spring/src/main/java/bitronix/tm/integration/spring/PlatformTransactionManager.java
Apache-2.0
@Override protected TransactionManager retrieveTransactionManager() throws TransactionSystemException { return transactionManager; }
Bitronix-specific Spring PlatformTransactionManager implementation. @author Marcus Klimstra (CGI)
retrieveTransactionManager
java
scalar-labs/btm
btm-spring/src/main/java/bitronix/tm/integration/spring/PlatformTransactionManager.java
https://github.com/scalar-labs/btm/blob/master/btm-spring/src/main/java/bitronix/tm/integration/spring/PlatformTransactionManager.java
Apache-2.0
@Override protected Object retrieveTransactionSynchronizationRegistry() throws TransactionSystemException { return transactionManager; }
Bitronix-specific Spring PlatformTransactionManager implementation. @author Marcus Klimstra (CGI)
retrieveTransactionSynchronizationRegistry
java
scalar-labs/btm
btm-spring/src/main/java/bitronix/tm/integration/spring/PlatformTransactionManager.java
https://github.com/scalar-labs/btm/blob/master/btm-spring/src/main/java/bitronix/tm/integration/spring/PlatformTransactionManager.java
Apache-2.0
public Class<PoolingDataSource> getObjectType() { return PoolingDataSource.class; }
FactoryBean for PoolingDataSource to correctly manage its lifecycle when used with Spring. @author Marcus Klimstra (CGI)
getObjectType
java
scalar-labs/btm
btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
https://github.com/scalar-labs/btm/blob/master/btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
Apache-2.0
public boolean isSingleton() { return true; }
FactoryBean for PoolingDataSource to correctly manage its lifecycle when used with Spring. @author Marcus Klimstra (CGI)
isSingleton
java
scalar-labs/btm
btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
https://github.com/scalar-labs/btm/blob/master/btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
Apache-2.0
public PoolingDataSource getObject() throws Exception { if (ds == null) { ds = new PoolingDataSource(); PropertyUtils.setProperties(ds, PropertyUtils.getProperties(this)); log.debug("Initializing PoolingDataSource with id '{}'", ds.getUniqueName()); ds.init(); ...
FactoryBean for PoolingDataSource to correctly manage its lifecycle when used with Spring. @author Marcus Klimstra (CGI)
getObject
java
scalar-labs/btm
btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
https://github.com/scalar-labs/btm/blob/master/btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
Apache-2.0
public void destroy() throws Exception { if (ds != null) { log.debug("Closing PoolingDataSource with id '{}'", ds.getUniqueName()); ds.close(); ds = null; } }
FactoryBean for PoolingDataSource to correctly manage its lifecycle when used with Spring. @author Marcus Klimstra (CGI)
destroy
java
scalar-labs/btm
btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
https://github.com/scalar-labs/btm/blob/master/btm-spring/src/main/java/bitronix/tm/integration/spring/PoolingDataSourceFactoryBean.java
Apache-2.0
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (FlipperUtils.shouldEnableFlipper(context)) { final FlipperClient client = AndroidFlipperClient.getInstance(context); client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults...
Class responsible of loading Flipper inside your React Native application. This is the debug flavor of it. Here you can add your own plugins and customize the Flipper setup.
initializeFlipper
java
a7medev/react-native-ml-kit
example/android/app/src/debug/java/com/rnmlkitexample/ReactNativeFlipper.java
https://github.com/a7medev/react-native-ml-kit/blob/master/example/android/app/src/debug/java/com/rnmlkitexample/ReactNativeFlipper.java
MIT