From dev-return-69958-archive-asf-public=cust-asf.ponee.io@activemq.apache.org Thu Feb 14 15:23:41 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 309DD180626 for ; Thu, 14 Feb 2019 16:23:41 +0100 (CET) Received: (qmail 91322 invoked by uid 500); 14 Feb 2019 15:23:35 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 91305 invoked by uid 99); 14 Feb 2019 15:23:35 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2019 15:23:35 +0000 From: GitBox To: dev@activemq.apache.org Subject: [GitHub] jdanekrh commented on a change in pull request #2467: ARTEMIS-2205 Performance improvements on AMQP and other parts Message-ID: <155015781468.11605.10739610212010295798.gitbox@gitbox.apache.org> Date: Thu, 14 Feb 2019 15:23:34 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit jdanekrh commented on a change in pull request #2467: ARTEMIS-2205 Performance improvements on AMQP and other parts URL: https://github.com/apache/activemq-artemis/pull/2467#discussion_r256879260 ########## File path: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ProtonHandler.java ########## @@ -106,75 +106,51 @@ public ProtonHandler(Executor flushExecutor, boolean isServer) { } public Long tick(boolean firstTick) { - if (firstTick) { - // the first tick needs to guarantee a lock here - lock.lock(); - } else { - if (!lock.tryLock()) { - log.debug("Cannot hold a lock on ProtonHandler for Tick, it will retry shortly"); - // if we can't lock the scheduler will retry in a very short period of time instead of holding the lock here - return null; - } - } - try { - if (!firstTick) { - try { - if (connection.getLocalState() != EndpointState.CLOSED) { - long rescheduleAt = transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())); - if (transport.isClosed()) { - throw new IllegalStateException("Channel was inactive for to long"); - } - return rescheduleAt; + requireHandler(); + if (!firstTick) { + try { + if (connection.getLocalState() != EndpointState.CLOSED) { + long rescheduleAt = transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())); + if (transport.isClosed()) { + throw new IllegalStateException("Channel was inactive for to long"); } - } catch (Exception e) { - log.warn(e.getMessage(), e); - transport.close(); - connection.setCondition(new ErrorCondition()); + return rescheduleAt; } - return 0L; + } catch (Exception e) { + log.warn(e.getMessage(), e); + transport.close(); + connection.setCondition(new ErrorCondition()); + } finally { + flush(); } - return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())); - } finally { - lock.unlock(); - flushBytes(); + return 0L; } + return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime())); } /** * We cannot flush until the initial handshake was finished. * If this happens before the handshake, the connection response will happen without SASL * and the client will respond and fail with an invalid code. - * */ + */ public void scheduledFlush() { if (receivedFirstPacket) { flush(); } } public int capacity() { - lock.lock(); - try { - return transport.capacity(); - } finally { - lock.unlock(); - } - } - - public void lock() { - lock.lock(); + requireHandler(); + return transport.capacity(); } - public void unlock() { - lock.unlock(); - } - - public boolean tryLock(long time, TimeUnit timeUnit) { - try { - return lock.tryLock(time, timeUnit); - } catch (InterruptedException e) { - - Thread.currentThread().interrupt(); - return false; + public void requireHandler() { + if (!workerExecutor.inEventLoop()) { + new Exception("saco!!!").printStackTrace(); Review comment: Leftover debug code here? (currently still on master) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services