Skip to content

Instantly share code, notes, and snippets.

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
public void resendPending() throws Exception
{
// In case the RESET wasn't sent yet to the remote node, we may eventually miss a node send,
// on that case the cluster-reset information will ask the group to resend any pending information
try
{
lock.lock();
#JournalFileImpl: (hornetq-data-1.hq id = 1, recordID = 1) (size=102400)
operation@AddRecord;recordID=9;userRecordType=31;isUpdate=false;compactCount=0;Message(messageID=9;properties=[#properties = 0] - ServerMessage[messageID=9,durable=true,userID=null,priority=4, bodySize=128,expiration=0, durable=true, address=jms.queue.mdbQueue,properties=TypedProperties[null]]@1685235300
operation@Update;recordID=9;userRecordType=32;isUpdate=true;compactCount=0;AddRef;QueueEncoding [queueID=2]
#JournalFileImpl: (hornetq-data-2.hq id = 2, recordID = 2) (size=102400)
protected HornetQRASession allocateConnection(boolean transacted, int acknowledgeMode, final int sessionType) throws JMSException
{
if (HornetQRASessionFactoryImpl.trace)
{
HornetQRALogger.LOGGER.trace("allocateConnection(" + transacted +
", " +
acknowledgeMode +
", " +
sessionType +
")");
internalClose();
for (Channel channel : channels.values())
{
channel.returnBlocking();
}
// Then call the listeners
callFailureListeners(me);
public Thread newThread(final Runnable command)
{
// attach the thread to a group only if there is no security manager:
// when sandboxed, the code does not have the RuntimePermission modifyThreadGroup
final Thread t = (Thread)AccessController.doPrivileged(new PrivilegedAction<Object>()
{
public Object run()
{
public void returnBlocking(Exception cause)
{
lock.lock();
try
{
HornetQException ex = HornetQClientMessageBundle.BUNDLE.unblockingACall();
ex.initCause(cause);
response = new HornetQExceptionMessage(ex);
if (response.getType() == PacketImpl.EXCEPTION)
{
final HornetQExceptionMessage mem = (HornetQExceptionMessage) response;
HornetQException e = mem.getException();
Throwable cause = e.getCause();
e.fillInStackTrace();
@Test
public void testloop() throws Exception
{
for (int i = 0 ; i < 100; i++)
{
System.out.println("#test " + i);
testForceBlockingReturn();
tearDown();
setUp();
}
private void write(final ChannelHandlerContext ctx) {
synchronized (lock) {
while (true) {
int pending = transport.pending();
if (pending > 0) {
final int size = pending - offset;
if (size > 0) {
ByteBuf buffer = Unpooled.buffer(size);
ByteBuffer head = transport.head();