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 |
|---|---|---|---|---|---|---|---|
public boolean append(int i) {
int newcount = bufSize + 4;
if (newcount > buf.length) {
expand(newcount);
}
XByteBuffer.toBytes(i,buf,bufSize);
bufSize = newcount;
return true;
} | Appends the data to the buffer. If the data is incorrectly formatted, ie, the data should always start with the
header, false will be returned and the data will be discarded.
@param b - bytes to be appended
@param len - the number of bytes to append.
@return true if the data was appended correctly. Returns false if the... | append | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public boolean append(byte[] b, int off, int len) {
if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return false;
}
int newcount = bufSiz... | Appends the data to the buffer. If the data is incorrectly formatted, ie, the data should always start with the
header, false will be returned and the data will be discarded.
@param b - bytes to be appended
@param len - the number of bytes to append.
@return true if the data was appended correctly. Returns false if the... | append | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public void expand(int newcount) {
//don't change the allocation strategy
byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)];
System.arraycopy(buf, 0, newbuf, 0, bufSize);
buf = newbuf;
} | Appends the data to the buffer. If the data is incorrectly formatted, ie, the data should always start with the
header, false will be returned and the data will be discarded.
@param b - bytes to be appended
@param len - the number of bytes to append.
@return true if the data was appended correctly. Returns false if the... | expand | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public int getCapacity() {
return buf.length;
} | Appends the data to the buffer. If the data is incorrectly formatted, ie, the data should always start with the
header, false will be returned and the data will be discarded.
@param b - bytes to be appended
@param len - the number of bytes to append.
@return true if the data was appended correctly. Returns false if the... | getCapacity | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public int countPackages() {
return countPackages(false);
} | Internal mechanism to make a check if a complete package exists
within the buffer
@return - true if a complete package (header,compress,size,data,footer) exists within the buffer | countPackages | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public int countPackages(boolean first)
{
int cnt = 0;
int pos = START_DATA.length;
int start = 0;
while ( start < bufSize ) {
//first check start header
int index = XByteBuffer.firstIndexOf(buf,start,START_DATA);
//if the header (START_DATA) isn'... | Internal mechanism to make a check if a complete package exists
within the buffer
@return - true if a complete package (header,compress,size,data,footer) exists within the buffer | countPackages | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public boolean doesPackageExist() {
return (countPackages(true)>0);
} | Method to check if a package exists in this byte buffer.
@return - true if a complete package (header,options,size,data,footer) exists within the buffer | doesPackageExist | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static byte[] createDataPackage(ChannelData cdata) {
// return createDataPackage(cdata.getDataPackage());
//avoid one extra byte array creation
int dlength = cdata.getDataPackageLength();
int length = getDataPackageLength(dlength);
byte[] data = new byte[length];
in... | Creates a complete data package
@param cdata - the message data to be contained within the package
@return - a full package (header,size,data,footer) | createDataPackage | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static byte[] createDataPackage(byte[] data, int doff, int dlength, byte[] buffer, int bufoff) {
if ( (buffer.length-bufoff) > getDataPackageLength(dlength) ) {
throw new ArrayIndexOutOfBoundsException("");
}
System.arraycopy(START_DATA, 0, buffer, bufoff, START_DATA.length);
... | Creates a complete data package
@param cdata - the message data to be contained within the package
@return - a full package (header,size,data,footer) | createDataPackage | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static int getDataPackageLength(int datalength) {
int length =
START_DATA.length + //header length
4 + //data length indicator
datalength + //actual data length
END_DATA.length; //footer length
return length;
} | Creates a complete data package
@param cdata - the message data to be contained within the package
@return - a full package (header,size,data,footer) | getDataPackageLength | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static byte[] createDataPackage(byte[] data) {
int length = getDataPackageLength(data.length);
byte[] result = new byte[length];
return createDataPackage(data,0,data.length,result,0);
} | Creates a complete data package
@param cdata - the message data to be contained within the package
@return - a full package (header,size,data,footer) | createDataPackage | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static int toInt(byte[] b,int off){
return ( ( b[off+3]) & 0xFF) +
( ( ( b[off+2]) & 0xFF) << 8) +
( ( ( b[off+1]) & 0xFF) << 16) +
( ( ( b[off+0]) & 0xFF) << 24);
} | Convert four bytes to an int
@param b - the byte array containing the four bytes
@param off - the offset
@return the integer value constructed from the four bytes | toInt | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static long toLong(byte[] b,int off){
return ( ( (long) b[off+7]) & 0xFF) +
( ( ( (long) b[off+6]) & 0xFF) << 8) +
( ( ( (long) b[off+5]) & 0xFF) << 16) +
( ( ( (long) b[off+4]) & 0xFF) << 24) +
( ( ( (long) b[off+3]) & 0xFF) << 32) +
( ( ( (lon... | Convert eight bytes to a long
@param b - the byte array containing the four bytes
@param off - the offset
@return the long value constructed from the eight bytes | toLong | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static byte[] toBytes(boolean bool, byte[] data, int offset) {
data[offset] = (byte)(bool?1:0);
return data;
} | Converts a boolean and put it in a byte array.
@param bool the integer
@param data the byte buffer in which the boolean will be placed
@param offset the offset in the byte array
@return the byte array | toBytes | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static boolean toBoolean(byte[] b, int offset) {
return b[offset] != 0;
} | Converts a byte array entry to boolean.
@param b byte array
@param offset within byte array
@return true if byte array entry is non-zero, false otherwise | toBoolean | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static byte[] toBytes(int n, byte[] b, int offset) {
b[offset+3] = (byte) (n);
n >>>= 8;
b[offset+2] = (byte) (n);
n >>>= 8;
b[offset+1] = (byte) (n);
n >>>= 8;
b[offset+0] = (byte) (n);
return b;
} | Converts an integer to four bytes.
@param n the integer
@param b the byte buffer in which the integer will be placed
@param offset the offset in the byte array
@return four bytes in an array | toBytes | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static byte[] toBytes(long n, byte[] b, int offset) {
b[offset+7] = (byte) (n);
n >>>= 8;
b[offset+6] = (byte) (n);
n >>>= 8;
b[offset+5] = (byte) (n);
n >>>= 8;
b[offset+4] = (byte) (n);
n >>>= 8;
b[offset+3] = (byte) (n);
n >>>= 8;... | Converts a long to eight bytes.
@param n the long
@param b the byte buffer in which the integer will be placed
@param offset the offset in the byte array
@return eight bytes in an array | toBytes | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static int firstIndexOf(byte[] src, int srcOff, byte[] find){
int result = -1;
if (find.length > src.length) return result;
if (find.length == 0 || src.length == 0) return result;
if (srcOff >= src.length ) throw new ArrayIndexOutOfBoundsException();
boolean found = false;... | Similar to a String.IndexOf, but uses pure bytes.
@param src - the source bytes to be searched
@param srcOff - offset on the source buffer
@param find - the string to be found within src
@return - the index of the first matching byte. -1 if the find array is not found | firstIndexOf | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public static byte[] serialize(Serializable msg) throws IOException {
ByteArrayOutputStream outs = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(outs);
out.writeObject(msg);
out.flush();
byte[] data = outs.toByteArray();
return data;
} | Serializes a message into cluster data
@param msg ClusterMessage
@return serialized content as byte[] array
@throws IOException Serialization error | serialize | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public void setDiscard(boolean discard) {
this.discard = discard;
} | Serializes a message into cluster data
@param msg ClusterMessage
@return serialized content as byte[] array
@throws IOException Serialization error | setDiscard | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
public boolean getDiscard() {
return discard;
} | Serializes a message into cluster data
@param msg ClusterMessage
@return serialized content as byte[] array
@throws IOException Serialization error | getDiscard | java | threedr3am/learnjavabug | tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | https://github.com/threedr3am/learnjavabug/blob/master/tomcat/sync-session-bug/src/main/java/com/threedr3am/bug/tomcat/sync/session/support/XByteBuffer.java | MIT |
@Override
public int getStatus() throws SystemException {
return status;
} | Implementation of {@link Transaction}.
@author Ludovic Orban | getStatus | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public boolean enlistResource(XAResource xaResource) throws RollbackException, IllegalStateException, SystemException {
if (status == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("transaction hasn't started yet");
if (status == Status.STATUS_MARKED_ROLLBACK)
... | Implementation of {@link Transaction}.
@author Ludovic Orban | enlistResource | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public boolean delistResource(final XAResource xaResource, final int flag) throws IllegalStateException, SystemException {
if (status == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("transaction hasn't started yet");
if (flag != XAResource.TMSUCCESS && flag != ... | Implementation of {@link Transaction}.
@author Ludovic Orban | delistResource | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public boolean visit(XAResourceHolderState xaResourceHolderState) {
try {
result &= delistResource(xaResourceHolderState, flag);
} catch (BitronixSystemException ex) {
if (log.isDebugEnabled()) { log.debug("failed to delist re... | Implementation of {@link Transaction}.
@author Ludovic Orban | visit | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private boolean delistResource(XAResourceHolderState resourceHolderState, int flag) throws BitronixSystemException {
try {
return resourceManager.delist(resourceHolderState, flag);
}
catch (XAException ex) {
// if the resource could not be delisted, the transaction must no... | Implementation of {@link Transaction}.
@author Ludovic Orban | delistResource | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public void registerSynchronization(Synchronization synchronization) throws RollbackException, IllegalStateException, SystemException {
if (status == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("transaction hasn't started yet");
if (status == Status.STATUS_MAR... | Implementation of {@link Transaction}.
@author Ludovic Orban | registerSynchronization | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
public Scheduler<Synchronization> getSynchronizationScheduler() {
return synchronizationScheduler;
} | Implementation of {@link Transaction}.
@author Ludovic Orban | getSynchronizationScheduler | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException {
if (status == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("transaction hasn't started yet");
if (isDone())
thro... | Implementation of {@link Transaction}.
@author Ludovic Orban | commit | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public void rollback() throws IllegalStateException, SystemException {
if (status == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("transaction hasn't started yet");
if (isDone())
throw new IllegalStateException("transaction is done, cannot roll it b... | Implementation of {@link Transaction}.
@author Ludovic Orban | rollback | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
if (status == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("transaction hasn't started yet");
if (isDone())
throw new IllegalStateException("transaction is done, cannot ch... | Implementation of {@link Transaction}.
@author Ludovic Orban | setRollbackOnly | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
public XAResourceManager getResourceManager() {
return resourceManager;
} | Implementation of {@link Transaction}.
@author Ludovic Orban | getResourceManager | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
public void timeout() throws BitronixSystemException {
this.timeout = true;
setStatus(Status.STATUS_MARKED_ROLLBACK);
log.warn("transaction timed out: " + this);
} | Implementation of {@link Transaction}.
@author Ludovic Orban | timeout | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
public boolean timedOut() {
return timeout;
} | Implementation of {@link Transaction}.
@author Ludovic Orban | timedOut | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
public void setActive(int timeout) throws IllegalStateException, SystemException {
if (status != Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("transaction has already started");
setStatus(Status.STATUS_ACTIVE);
this.startDate = new Date(MonotonicClock.currentTimeMil... | Implementation of {@link Transaction}.
@author Ludovic Orban | setActive | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
public void setStatus(int status) throws BitronixSystemException {
setStatus(status, resourceManager.collectUniqueNames());
} | Implementation of {@link Transaction}.
@author Ludovic Orban | setStatus | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
public void setStatus(int status, Set<String> uniqueNames) throws BitronixSystemException {
try {
boolean force = (resourceManager.size() > 1) && (status == Status.STATUS_COMMITTING);
if (log.isDebugEnabled()) { log.debug("changing transaction status to " + Decoder.decodeStatus(status) +... | Implementation of {@link Transaction}.
@author Ludovic Orban | setStatus | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private void fireTransactionStatusChangedEvent(int oldStatus, int newStatus) {
if (log.isDebugEnabled()) log.debug("transaction status is changing from " + Decoder.decodeStatus(oldStatus) + " to " +
Decoder.decodeStatus(newStatus) + " - executing " + transactionStatusListeners.size() + " listene... | Implementation of {@link Transaction}.
@author Ludovic Orban | fireTransactionStatusChangedEvent | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public int hashCode() {
return resourceManager.getGtrid().hashCode();
} | Implementation of {@link Transaction}.
@author Ludovic Orban | hashCode | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public boolean equals(Object obj) {
if (obj instanceof BitronixTransaction) {
BitronixTransaction tx = (BitronixTransaction) obj;
return resourceManager.getGtrid().equals(tx.resourceManager.getGtrid());
}
return false;
} | Implementation of {@link Transaction}.
@author Ludovic Orban | equals | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public String toString() {
return "a Bitronix Transaction with GTRID [" + resourceManager.getGtrid() + "], status=" + Decoder.decodeStatus(status) + ", " + resourceManager.size() + " resource(s) enlisted (started " + startDate + ")";
} | Implementation of {@link Transaction}.
@author Ludovic Orban | toString | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private void rollbackPrepareFailure(RollbackException rbEx) throws BitronixSystemException {
List<XAResourceHolderState> interestedResources = resourceManager.getAllResources();
try {
rollbacker.rollback(this, interestedResources);
if (log.isDebugEnabled()) { log.debug("rollback ... | Rollback resources after a phase 1 prepare failure. All resources must be rolled back as prepared ones
are in-doubt and non-prepared ones have started/ended work done that must also be cleaned.
@param rbEx the thrown rollback exception.
@throws BitronixSystemException when a resource could not rollback prepapared state... | rollbackPrepareFailure | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private void fireBeforeCompletionEvent() throws BitronixSystemException {
if (log.isDebugEnabled()) { log.debug("before completion, " + synchronizationScheduler.size() + " synchronization(s) to execute"); }
Iterator<Synchronization> it = synchronizationScheduler.reverseIterator();
while (it.hasN... | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | fireBeforeCompletionEvent | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private void fireAfterCompletionEvent() {
// this TX is no longer in-flight -> remove this transaction's state from all XAResourceHolders
getResourceManager().clearXAResourceHolderStates();
if (log.isDebugEnabled()) { log.debug("after completion, " + synchronizationScheduler.size() + " synchron... | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | fireAfterCompletionEvent | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
static String buildZeroTransactionDebugMessage(StackTrace activationStackTrace, StackTrace commitStackTrace) {
String lineSeparator = System.getProperty("line.separator");
final StringBuilder sb = new StringBuilder();
sb.append("committed transaction with 0 enlisted resource").append(lineSeparat... | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | buildZeroTransactionDebugMessage | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private boolean isDone() {
switch (status) {
case Status.STATUS_PREPARING:
case Status.STATUS_PREPARED:
case Status.STATUS_COMMITTING:
case Status.STATUS_COMMITTED:
case Status.STATUS_ROLLING_BACK:
case Status.STATUS_ROLLEDBACK:
... | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | isDone | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private boolean isWorking() {
switch (status) {
case Status.STATUS_PREPARING:
case Status.STATUS_PREPARED:
case Status.STATUS_COMMITTING:
case Status.STATUS_ROLLING_BACK:
return true;
}
return false;
} | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | isWorking | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public String getGtrid() {
return resourceManager.getGtrid().toString();
} | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | getGtrid | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public String getStatusDescription() {
return Decoder.decodeStatus(status);
} | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | getStatusDescription | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public Collection<String> getEnlistedResourcesUniqueNames() {
return resourceManager.collectUniqueNames();
} | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | getEnlistedResourcesUniqueNames | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public String getThreadName() {
return threadName;
} | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | getThreadName | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
@Override
public Date getStartDate() {
return startDate;
} | Run all registered Synchronizations' beforeCompletion() method. Be aware that this method can change the
transaction status to mark it as rollback only for instance.
@throws bitronix.tm.internal.BitronixSystemException if status changing due to a synchronization throwing an
exception fails. | getStartDate | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
StackTrace getActivationStackTrace() {
return activationStackTrace;
} | Returns the activation {@link StackTrace} if it is available.
@return the call stack of where the transaction began | getActivationStackTrace | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransaction.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransaction.java | Apache-2.0 |
private SortedMap<BitronixTransaction, ClearContextSynchronization> createInFlightTransactionsMap()
throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
final boolean debug = log.isDebugEnabled();
if (debug) { log.debug("Creating sorted me... | Create the {@link BitronixTransactionManager}. Open the journal, load resources and perform recovery
synchronously. The recovery service then gets scheduled for background recovery. | createInFlightTransactionsMap | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public int compare(BitronixTransaction t1, BitronixTransaction t2) {
Long timestamp1 = t1.getResourceManager().getGtrid().extractTimestamp();
Long timestamp2 = t2.getResourceManager().getGtrid().extractTimestamp();
int compareTo = ti... | Create the {@link BitronixTransactionManager}. Open the journal, load resources and perform recovery
synchronously. The recovery service then gets scheduled for background recovery. | compare | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void begin() throws NotSupportedException, SystemException {
if (log.isDebugEnabled()) { log.debug("beginning a new transaction"); }
if (isShuttingDown())
throw new BitronixSystemException("cannot start a new transaction, transaction manager is shutting down");
... | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | begin | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
BitronixTransaction currentTx = getCurrentTransaction();
if (log.isDebugEnabled()) { log.debug("committing transaction " + current... | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | commit | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void rollback() throws IllegalStateException, SecurityException, SystemException {
BitronixTransaction currentTx = getCurrentTransaction();
if (log.isDebugEnabled()) { log.debug("rolling back transaction " + currentTx); }
if (currentTx == null)
throw new IllegalS... | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | rollback | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public int getStatus() throws SystemException {
BitronixTransaction currentTx = getCurrentTransaction();
if (currentTx == null)
return Status.STATUS_NO_TRANSACTION;
return currentTx.getStatus();
} | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | getStatus | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public Transaction getTransaction() throws SystemException {
return getCurrentTransaction();
} | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | getTransaction | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
BitronixTransaction currentTx = getCurrentTransaction();
if (log.isDebugEnabled()) { log.debug("marking transaction as rollback only: " + currentTx); }
if (currentTx == null)
throw new Illegal... | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | setRollbackOnly | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void setTransactionTimeout(int seconds) throws SystemException {
if (seconds < 0)
throw new BitronixSystemException("cannot set a timeout to less than 0 second (was: " + seconds + "s)");
ThreadContext.getThreadContext().setTimeout(seconds);
} | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | setTransactionTimeout | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public Transaction suspend() throws SystemException {
BitronixTransaction currentTx = getCurrentTransaction();
if (log.isDebugEnabled()) { log.debug("suspending transaction " + currentTx); }
if (currentTx == null)
return null;
try {
currentTx.getRes... | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | suspend | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void resume(Transaction transaction) throws InvalidTransactionException, IllegalStateException, SystemException {
if (log.isDebugEnabled()) { log.debug("resuming " + transaction); }
if (transaction == null)
throw new InvalidTransactionException("resumed transaction canno... | Start a new transaction and bind the context to the calling thread.
@throws NotSupportedException if a transaction is already bound to the calling thread.
@throws SystemException if the transaction manager is shutting down. | resume | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public Reference getReference() throws NamingException {
return new Reference(
BitronixTransactionManager.class.getName(),
new StringRefAddr("TransactionManager", "BitronixTransactionManager"),
BitronixTransactionManagerObjectFactory.class.getName(),... | BitronixTransactionManager can only have a single instance per JVM so this method always returns a reference
with no special information to find back the sole instance. BitronixTransactionManagerObjectFactory will be used
by the JNDI server to get the BitronixTransactionManager instance of the JVM.
@return an empty re... | getReference | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
public int getInFlightTransactionCount() {
return inFlightTransactions.size();
} | Return a count of the current in-flight transactions. Currently this method is only called by unit tests.
@return a count of in-flight transactions | getInFlightTransactionCount | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
public long getOldestInFlightTransactionTimestamp() {
try {
// The inFlightTransactions map is sorted by timestamp, so the first transaction is always the oldest
BitronixTransaction oldestTransaction = inFlightTransactions.firstKey();
long oldestTimestamp = oldestTransaction.getResour... | Return the timestamp of the oldest in-flight transaction.
@return the timestamp or Long.MIN_VALUE if there is no in-flight transaction. | getOldestInFlightTransactionTimestamp | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
public BitronixTransaction getCurrentTransaction() {
return ThreadContext.getThreadContext().getTransaction();
} | Get the transaction currently registered on the current thread context.
@return the current transaction or null if no transaction has been started on the current thread. | getCurrentTransaction | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
private boolean isShuttingDown() {
return shuttingDown;
} | Check if the transaction manager is in the process of shutting down.
@return true if the transaction manager is in the process of shutting down. | isShuttingDown | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
public void dumpTransactionContexts() {
if (!log.isDebugEnabled())
return;
// We're using an iterator, so we must synchronize on the collection
synchronized (inFlightTransactions) {
log.debug("dumping " + inFlightTransactions.size() + " transaction context(s)");
for (... | Dump an overview of all running transactions as debug logs. | dumpTransactionContexts | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public synchronized void shutdown() {
if (isShuttingDown()) {
if (log.isDebugEnabled()) { log.debug("Transaction Manager has already shut down"); }
return;
}
log.info("shutting down Bitronix Transaction Manager");
internalShutdown();
if (lo... | Shut down the transaction manager and release all resources held by it.
<p>This call will also close the resources pools registered by the {@link bitronix.tm.resource.ResourceLoader}
like JMS and JDBC pools. The manually created ones are left untouched.</p>
<p>The Transaction Manager will wait during a configurable gra... | shutdown | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
private void internalShutdown() {
shuttingDown = true;
dumpTransactionContexts();
int seconds = TransactionManagerServices.getConfiguration().getGracefulShutdownInterval();
int txCount = 0;
try {
txCount = inFlightTransactions.size();
while (seconds > 0 ... | Shut down the transaction manager and release all resources held by it.
<p>This call will also close the resources pools registered by the {@link bitronix.tm.resource.ResourceLoader}
like JMS and JDBC pools. The manually created ones are left untouched.</p>
<p>The Transaction Manager will wait during a configurable gra... | internalShutdown | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public String toString() {
return "a BitronixTransactionManager with " + inFlightTransactions.size() + " in-flight transaction(s)";
} | Shut down the transaction manager and release all resources held by it.
<p>This call will also close the resources pools registered by the {@link bitronix.tm.resource.ResourceLoader}
like JMS and JDBC pools. The manually created ones are left untouched.</p>
<p>The Transaction Manager will wait during a configurable gra... | toString | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
private void logVersion() {
log.info("Bitronix Transaction Manager version " + Version.getVersion());
if (log.isDebugEnabled()) { log.debug("JVM version " + System.getProperty("java.version")); }
} | Output BTM version information as INFO log. | logVersion | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
private BitronixTransaction createTransaction() {
BitronixTransaction transaction = new BitronixTransaction();
ThreadContext.getThreadContext().setTransaction(transaction);
MDC.put(MDC_GTRID_KEY, transaction.getGtrid());
return transaction;
} | Create a new transaction on the current thread's context.
@return the created transaction. | createTransaction | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
private void clearCurrentContextForSuspension() {
if (log.isDebugEnabled()) { log.debug("clearing current thread context: " + ThreadContext.getThreadContext()); }
ThreadContext.getThreadContext().clearTransaction();
} | Unlink the transaction from the current thread's context. | clearCurrentContextForSuspension | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void beforeCompletion() {
} | Unlink the transaction from the current thread's context. | beforeCompletion | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public void afterCompletion(int status) {
ThreadContext context = threadContext.get();
if (context != null) {
if (log.isDebugEnabled()) { log.debug("clearing transaction from thread context: " + context); }
context.clearTransaction();
}
els... | Unlink the transaction from the current thread's context. | afterCompletion | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public String toString() {
return "a ClearContextSynchronization for " + currentTx;
} | Unlink the transaction from the current thread's context. | toString | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManager.java | Apache-2.0 |
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception {
if (log.isDebugEnabled()) { log.debug("returning the unique transaction manager instance"); }
return TransactionManagerServices.getTransactionManager();
} | Since there can be only one transaction manager per VM instance, this method always returns a reference
to the unique BitronixTransactionManager object.
@throws java.lang.Exception thrown if an instance of the transaction manager cannot be created
@see BitronixTransactionManager
@return the unique transaction manager i... | getObjectInstance | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionManagerObjectFactory.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionManagerObjectFactory.java | Apache-2.0 |
@Override
protected Map<Object, Object> initialValue() {
return new HashMap<Object, Object>();
} | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | initialValue | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public Object getResource(Object key) {
try {
if (key == null)
throw new NullPointerException("key cannot be null");
if (currentTransaction() == null || currentTransaction().getStatus() == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateE... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | getResource | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public boolean getRollbackOnly() {
try {
if (currentTransaction() == null || currentTransaction().getStatus() == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("no transaction started on current thread");
return currentTransaction().getStatus... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | getRollbackOnly | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public Object getTransactionKey() {
try {
if (currentTransaction() == null || currentTransaction().getStatus() == Status.STATUS_NO_TRANSACTION)
return null;
return currentTransaction().getGtrid();
} catch (SystemException ex) {
throw new... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | getTransactionKey | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public int getTransactionStatus() {
try {
if (currentTransaction() == null)
return Status.STATUS_NO_TRANSACTION;
return currentTransaction().getStatus();
} catch (SystemException ex) {
throw new BitronixRuntimeException("cannot get curre... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | getTransactionStatus | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public void putResource(Object key, Object value) {
try {
if (key == null)
throw new NullPointerException("key cannot be null");
if (currentTransaction() == null || currentTransaction().getStatus() == Status.STATUS_NO_TRANSACTION)
throw new I... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | putResource | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public void registerInterposedSynchronization(Synchronization synchronization) {
try {
if (currentTransaction() == null || currentTransaction().getStatus() == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("no transaction started on current thread");
... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | registerInterposedSynchronization | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public void setRollbackOnly() {
try {
if (currentTransaction() == null || currentTransaction().getStatus() == Status.STATUS_NO_TRANSACTION)
throw new IllegalStateException("no transaction started on current thread");
currentTransaction().setStatus(Status.ST... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | setRollbackOnly | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
private Map<Object, Object> getResources() {
return resourcesTl.get();
} | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | getResources | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
private BitronixTransaction currentTransaction() {
return transactionManager.getCurrentTransaction();
} | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | currentTransaction | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public Reference getReference() throws NamingException {
return new Reference(
BitronixTransactionManager.class.getName(),
new StringRefAddr("TransactionSynchronizationRegistry", "BitronixTransactionSynchronizationRegistry"),
BitronixTransactionSynch... | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | getReference | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public void beforeCompletion() {
} | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | beforeCompletion | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public void afterCompletion(int status) {
if (log.isDebugEnabled()) { log.debug("clearing resources"); }
getResources().clear();
} | Implementation of JTA 1.1 {@link TransactionSynchronizationRegistry}.
@author Ludovic Orban | afterCompletion | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistry.java | Apache-2.0 |
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception {
if (log.isDebugEnabled()) { log.debug("returning the unique synchronization registry instance"); }
return TransactionManagerServices.getTransactionSynchronizationRegistry(... | Since there can be only one synchronization registry per VM instance, this method always returns a reference
to the unique BitronixTransactionSynchronizationRegistry object.
@throws java.lang.Exception throw if an instance cannot be created
@see bitronix.tm.BitronixTransactionSynchronizationRegistry
@return the unique ... | getObjectInstance | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistryObjectFactory.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixTransactionSynchronizationRegistryObjectFactory.java | Apache-2.0 |
@Override
public int getFormatId() {
return FORMAT_ID;
} | Get Bitronix XID format ID. Defined by {@link BitronixXid#FORMAT_ID}.
@return the Bitronix XID format ID. | getFormatId | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixXid.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixXid.java | Apache-2.0 |
@Override
public byte[] getBranchQualifier() {
return branchQualifier.getArray();
} | Get the BQUAL of the XID.
@return the XID branch qualifier. | getBranchQualifier | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixXid.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixXid.java | Apache-2.0 |
public Uid getBranchQualifierUid() {
return branchQualifier;
} | Get the BQUAL of the XID.
@return the XID branch qualifier. | getBranchQualifierUid | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixXid.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixXid.java | Apache-2.0 |
@Override
public byte[] getGlobalTransactionId() {
return globalTransactionId.getArray();
} | Get the GTRID of the XID.
@return the XID global transaction ID. | getGlobalTransactionId | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixXid.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixXid.java | Apache-2.0 |
public Uid getGlobalTransactionIdUid() {
return globalTransactionId;
} | Get the GTRID of the XID.
@return the XID global transaction ID. | getGlobalTransactionIdUid | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixXid.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixXid.java | Apache-2.0 |
@Override
public String toString() {
return toStringValue;
} | Get a human-readable string representation of the XID.
@return a human-readable string representation. | toString | java | scalar-labs/btm | btm/src/main/java/bitronix/tm/BitronixXid.java | https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/BitronixXid.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.