From dev-return-69961-archive-asf-public=cust-asf.ponee.io@activemq.apache.org Thu Feb 14 16:53:32 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 2FF10180763 for ; Thu, 14 Feb 2019 17:53:32 +0100 (CET) Received: (qmail 71242 invoked by uid 500); 14 Feb 2019 16:53:31 -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 71220 invoked by uid 99); 14 Feb 2019 16:53:31 -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 16:53:31 +0000 From: GitBox To: dev@activemq.apache.org Subject: [GitHub] clebertsuconic commented on a change in pull request #2467: ARTEMIS-2205 Performance improvements on AMQP and other parts Message-ID: <155016321059.26925.376375664346143469.gitbox@gitbox.apache.org> Date: Thu, 14 Feb 2019 16:53:30 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit clebertsuconic 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_r256920259 ########## 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: OMG.. it still on the codebase? That's epic!!!! never supposed to happen though.. but still!!!! it's an almost bad word from PT-BR... meaning it would suck if it happened!!!! lol taking it out now!!!!! ---------------------------------------------------------------- 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