/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.tcap.api.tc.dialog.Dialog#getNewInvokeId()
507128
public Long getNewInvokeId() throws TCAPException {
        try {
            this.dialogLock.lock();
            if (this.freeCount == 0) {
                throw new TCAPException("No free invokeId");
            }

            int tryCnt = 0;
            while (true) {
                if (++this.lastInvokeIdIndex >= this.invokeIDTable.length)
                    this.lastInvokeIdIndex = 0;
                if (this.invokeIDTable[this.lastInvokeIdIndex] == _INVOKEID_FREE) {
                    freeCount--;
                    this.invokeIDTable[this.lastInvokeIdIndex] = _INVOKEID_TAKEN;
                    return getInvokeIdFromIndex(this.lastInvokeIdIndex);
                }
                if (++tryCnt >= 256)
                    throw new TCAPException("No free invokeId");
            }

        } finally {
            this.dialogLock.unlock();
        }
    }
408501
public final V invoke() {
        int s;
        if ((s = doInvoke() & DONE_MASK) != NORMAL)
            reportException(s);
        return getRawResult();
    }
188321
public long getPreviousSequenceId()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getPreviousSequenceId");
    long previousSequenceID=0;
    try
    {
      SIMPMessage msg = getSIMPMessage();
      if(msg!=null)
      {
        previousSequenceID = msg.getMessage().getGuaranteedValueStartTick()-1;
      }
    }
    catch (SIResourceException e)
    {
      // No FFDC code needed
      SibTr.exception(tc, e);
    } 
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getPreviousSequenceId", Long.valueOf(previousSequenceID));
    return previousSequenceID;
  }
745785
public String getNewToken(GrantType grantType) throws FoxHttpException, MalformedURLException {
        FoxHttpRequest request = this.generateRequestForGrantType(grantType);
        this.getOAuth2RequestExecutor().executeOAuth2Request(request, this);
        return getOAuth2Store().getAccessToken();
    }
1178981
public OmemoDevice getOwnDevice() {
        synchronized (LOCK) {
            BareJid jid = getOwnJid();
            if (jid == null) {
                return null;
            }
            return new OmemoDevice(jid, getDeviceId());
        }
    }
742686
public BaseListener getNextValidListener(int iMoveMode)
    {
        if (m_listener != null)
        {
            if ((m_listener.isEnabled()) & (m_listener.respondsToMode(iMoveMode)))
                return m_listener;
            else
                return m_listener.getNextValidListener(iMoveMode);
        }
        else
            return null;
    }
1322155
private boolean addIncomingInvokeId(Long invokeId) {
        synchronized (this.incomingInvokeList) {
            if (this.incomingInvokeList.contains(invokeId))
                return false;
            else {
                this.incomingInvokeList.add(invokeId);
                return true;
            }
        }
    }
1247201
private boolean handleNewInformation() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Parsing new information: " + getVirtualConnection());
        }

        final HttpInboundServiceContextImpl sc = getHTTPContext();

        if (!isPartiallyParsed()) {
            // this is the first pass through on parsing this new request
            // PK12235, check for a full stop only
            if (getChannel().isStopped()) {
                // channel stopped during the initial read, send error back
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Channel stopped during initial read");
                }
                sc.setHeadersParsed();
                // since we haven't parsed the request version, force the
                // response to the minimal 1.0 version
                sc.getResponse().setVersion(VersionValues.V10);
                sendErrorMessage(StatusCodes.UNAVAILABLE);
                return true;
            }
        }

        boolean completed = false;

        // if this is an http/2 link, don't perform additional parsing
        if (this.isAlpnHttp2Link(switchedVC)) {
            return false;
        }
        try {
            completed = sc.parseMessage();
        } catch (UnsupportedMethodException meth) {
            // no FFDC required
            sc.setHeadersParsed();
            sendErrorMessage(StatusCodes.NOT_IMPLEMENTED);
            setPartiallyParsed(false);
            return true;
        } catch (UnsupportedProtocolVersionException ver) {
            // no FFDC required
            sc.setHeadersParsed();
            sendErrorMessage(StatusCodes.UNSUPPORTED_VERSION);
            setPartiallyParsed(false);
            return true;
        } catch (MessageTooLargeException mtle) {
            // no FFDC required
            sc.setHeadersParsed();
            sendErrorMessage(StatusCodes.ENTITY_TOO_LARGE);
            setPartiallyParsed(false);
            return true;
        } catch (MalformedMessageException mme) {
            //no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "parseMessage encountered a MalformedMessageException : " + mme);
            }
            handleGenericHNIError(mme, sc);
            return true;
        } catch (IllegalArgumentException iae) {
            //no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "parseMessage encountered an IllegalArgumentException : " + iae);
            }
            handleGenericHNIError(iae, sc);
            return true;
        } catch (CompressionException ce) {
            //no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "parseMessage encountered a CompressionException : " + ce);
            }
            handleGenericHNIError(ce, sc);
            return true;
        } catch (Throwable t) {
            FFDCFilter.processException(t,
                                        "HttpInboundLink.handleNewInformation",
                                        "2", this);
            handleGenericHNIError(t, sc);
            return true;
        }

        // partialParsed is the opposite of the complete flag
        setPartiallyParsed(!completed);
        if (isPartiallyParsed()) {
            sc.setupReadBuffers(sc.getHttpConfig().getIncomingHdrBufferSize(), false);
        }
        return false;
    }
595016
public Dialog getNewDialog(SccpAddress localAddress, SccpAddress remoteAddress) throws TCAPException {
        DialogImpl res = getNewDialog(localAddress, remoteAddress, getNextSeqControl(), null);
        if (this.stack.getStatisticsEnabled()) {
            this.stack.getCounterProviderImpl().updateAllLocalEstablishedDialogsCount();
            this.stack.getCounterProviderImpl().updateAllEstablishedDialogsCount();
        }
        this.setSsnToDialog(res, localAddress.getSubsystemNumber());
        return res;
    }
1123739
@Override
  public Identifier getNewInstance(final String str) {

    final int index = str.indexOf("://");
    if (index < 0) {
      throw new RemoteRuntimeException("Invalid remote identifier name: " + str);
    }

    final String type = str.substring(0, index);
    final Class<? extends Identifier> clazz = typeToClazzMap.get(type);

    try {

      final Constructor<? extends Identifier> constructor = clazz.getDeclaredConstructor(CONSTRUCTOR_ARG_TYPES);
      final Object[] args = new Object[] {str.substring(index + 3)};

      final Identifier instance = constructor.newInstance(args);
      LOG.log(Level.FINER, "Created new identifier: {0} for {1}", new Object[] {instance, str});
      return instance;

    } catch (final NoSuchMethodException | SecurityException | InstantiationException
        | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
      LOG.log(Level.SEVERE, "Cannot create new identifier for: " + str, e);
      throw new RemoteRuntimeException(e);
    }
  }
42593
function getNewID()
    {
        $db = eZDB::instance();
        if( $db->supportsDefaultValuesInsertion() )
        {
            $db->query( 'INSERT INTO ezorder_nr_incr DEFAULT VALUES' );
        }
        else
        {
            $db->query( 'INSERT INTO ezorder_nr_incr(id) VALUES(DEFAULT)' );
        }

        return $db->lastSerialID( 'ezorder_nr_incr', 'id' );
    }
640540
private synchronized int getNewClientID() {
        if ((clientIDGenerator + 1) >= Integer.MAX_VALUE) {
            //if we can't find a reusable ID within the first 100 slots, then fail.
            //Revisit: I don't want to loop through all 2+ billion entries to find that they are all taken, as this
            //could be seem as a DoS, but maybe some better heuristics for finding an empty ID? not sure if we will ever be
            //in this situation...
            final int limit = Integer.MIN_VALUE + 100;
            for (int i = Integer.MIN_VALUE; i < limit; i++) {
                if (inboxes.get(i) == null) {
                    return i;
                }
            }

            //Emit the warning
            Tr.warning(tc, "jmx.connector.server.rest.notification.limit.warning");

            throw ErrorHelper.createRESTHandlerJsonException(new RuntimeException("The server has reached its limit of new client notifications."),
                                                             JSONConverter.getConverter(),
                                                             APIConstants.STATUS_SERVICE_UNAVAILABLE);
        }

        return clientIDGenerator++;
    }
984937
public final InternalFactHandle newFactHandle(Object object,
                                                  ObjectTypeConf conf,
                                                  InternalWorkingMemory workingMemory,
                                                  WorkingMemoryEntryPoint wmEntryPoint) {
        return newFactHandle( getNextId(),
                              object,
                              conf,
                              workingMemory,
                              wmEntryPoint );
    }
362413
@SuppressWarnings("unchecked")
    public I getNewInstance(String className) {
        try {
            return getNewInstance((Class<I>) Class.forName(className));
        } catch (ClassNotFoundException e) {
            throw new InitializationException("Given class not found", e);
        }
    }
137627
public static HandshakeMessage getDefaultMessage() {
    HandshakeMessage message = new HandshakeMessage();
    message.setProtocolString(HandshakeMessage.PROTOCOL_STRING);
    message.setReservedBits(HandshakeMessage.PROTOCOL_RESERVED_BITS);
    message.setStringLength(HandshakeMessage.PROTOCOL_STRING_LENGTH);
    message.setVersionNumber(HandshakeMessage.PROTOCOL_VERSION);
    return message;
  }
47735
public synchronized VNFFGAgent getVNFFGAgent() {
    if (this.vnffgAgent == null) {
      if (isService) {
        this.vnffgAgent =
            new VNFFGAgent(
                this.serviceName,
                this.projectId,
                this.sslEnabled,
                this.nfvoIp,
                this.nfvoPort,
                this.version,
                this.serviceKey);
      } else {
        this.vnffgAgent =
            new VNFFGAgent(
                this.username,
                this.password,
                this.projectId,
                this.sslEnabled,
                this.nfvoIp,
                this.nfvoPort,
                this.version);
      }
    }
    return this.vnffgAgent;
  }
285665
public final ControlPrevalue createNewControlPrevalue() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewControlPrevalue");
    ControlPrevalue msg = null;
    try {
      msg = new ControlPrevalueImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewControlPrevalue");
    return msg;
  }