localUpdateLongRunningFree

@param logicalAddress the logical address
@param freeCount the free count
767467
public void localUpdateLongRunningFree(Address logicalAddress, Long freeCount)
   {
      if (trace)
         log.tracef("LOCAL_UPDATE_LONGRUNNING_FREE(%s, %d)", logicalAddress, freeCount);

      DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(logicalAddress);

      if (dwm != null)
      {
         Collection<NotificationListener> copy =
            new ArrayList<NotificationListener>(dwm.getNotificationListeners());
         for (NotificationListener nl : copy)
         {
            nl.updateLongRunningFree(logicalAddress, freeCount);
         }
      }
      else
      {
         WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance();
         wmeq.addEvent(new WorkManagerEvent(WorkManagerEvent.TYPE_UPDATE_LONG_RUNNING, logicalAddress, freeCount));
      }
   }
1090870
public void freeUseCount()
  {
    if (_indirectSource != null) {
      _indirectSource.freeUseCount();
    }
    else if (_useCount != null) {
      if (_useCount.decrementAndGet() < 0) {
        closeSelf();
      }
    }
  }
1346211
@Override
    public FreeLruEntryResult freeLruEntry() {
        final String methodName = "freeLruEntry()";
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
        }
        return new FreeLruEntryResult();
    }
1104270
final LocalTransactionCoordinator beginLocalTx()
    {
        LocalTransactionCoordinator lCoord = null;

        try {
            ltcCurrent.begin();
            lCoord = getLocalCoord(); // d175585
            if (TraceComponent.isAnyTracingEnabled()) // d527372
            {
                if (tc.isEventEnabled())
                {
                    if (lCoord != null) {
                        Tr.event(tc, "Began LTC cntxt: tid=" +
                                     Integer.toHexString(lCoord.hashCode()) + "(LTC)");
                    } else {
                        Tr.event(tc, "Began LTC cntxt: " + "null Coordinator!");
                    }
                }
                // d165585 Begins
                if (lCoord != null && TETxLifeCycleInfo.isTraceEnabled()) // d171555
                {
                    TETxLifeCycleInfo.traceLocalTxBegin("" + System.identityHashCode(lCoord), "Begin Local Tx");
                }
                // d165585 Ends
            }
        } catch (Exception ex) {
            FFDCFilter.processException(ex, CLASS_NAME + ".beginLocalTx", "737", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Begin local tx failed", ex);
            }

        }
        return (lCoord);

    }
586113
@Override
    public void setScopeToLocalQP(String scopeToLocalQP) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setScopeToLocalQP", scopeToLocalQP);

        // Clear the cached destinationAddresses, as a change to this value would make them out-of-date
        clearCachedProducerDestinationAddress();
        clearCachedConsumerDestinationAddress();

        // Make sure null and empty are treated equally.
        if ((scopeToLocalQP == null) || ("".equals(scopeToLocalQP.trim())))
            scopeToLocalQP = null;

        if ((scopeToLocalQP == null) ||
            (ApiJmsConstants.SCOPE_TO_LOCAL_QP_OFF.equals(scopeToLocalQP) ||
            (ApiJmsConstants.SCOPE_TO_LOCAL_QP_ON.equals(scopeToLocalQP)))) {

            updateProperty(SCOPE_TO_LOCAL_QP, scopeToLocalQP);
        }
        else {
            // bad value, throw exception
            String key = "INVALID_VALUE_CWSIA0281";
            Object[] inserts = new Object[] { SCOPE_TO_LOCAL_QP, scopeToLocalQP };
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class, key, inserts, tc);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setScopeToLocalQP");
    }
520998
public void setInetAddress(final String address) {
        try {
            this.inetAddress = InetAddress.getByName(address);
        } catch (final UnknownHostException e) {
            throw new RuntimeException("Invalid address " + address);
        }
    }
486649
public void service_updateFlagsOnAllAccounts_POST(String service) throws IOException {
		String qPath = "/email/pro/{service}/updateFlagsOnAllAccounts";
		StringBuilder sb = path(qPath, service);
		exec(qPath, "POST", sb.toString(), null);
	}
777111
public final void incrementUnlockCount(long tick)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "incrementUnlockCount", Long.valueOf(tick));

    _targetStream.setCursor(tick);
    TickRange tickRange = _targetStream.getNext();
    if (tickRange.type == TickRange.Value)
    {
      AIValueTick valueTick = (AIValueTick) tickRange.value;
      if (valueTick != null)
        valueTick.incRMEUnlockCount();
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "incrementUnlockCount", tickRange);
  }
1267418
public static void loop(MastersSlavesListener listener, final GlobalStateInfo globalInfo,
      final List<HostAddress> addresses, SearchFilter searchFilter) throws SQLException {

    MastersSlavesProtocol protocol;
    ArrayDeque<HostAddress> loopAddresses = new ArrayDeque<>(addresses);
    if (loopAddresses.isEmpty()) {
      resetHostList(listener, loopAddresses);
    }

    int maxConnectionTry = listener.getRetriesAllDown();
    SQLException lastQueryException = null;
    boolean firstLoop = true;
    while (!loopAddresses.isEmpty() || (!searchFilter.isFailoverLoop() && maxConnectionTry > 0)) {
      protocol = getNewProtocol(listener.getProxy(), globalInfo, listener.getUrlParser());

      if (listener.isExplicitClosed() || (!listener.isSecondaryHostFailReconnect() && !listener
          .isMasterHostFailReconnect())) {
        return;
      }
      maxConnectionTry--;
      try {
        HostAddress host = loopAddresses.pollFirst();
        if (host == null) {
          loopAddresses.addAll(listener.getUrlParser().getHostAddresses());
          host = loopAddresses.pollFirst();
        }

        protocol.setHostAddress(host);

        protocol.connect();
        if (listener.isExplicitClosed()) {
          protocol.close();
          return;
        }

        listener.removeFromBlacklist(protocol.getHostAddress());

        if (listener.isMasterHostFailReconnect() && protocol.isMasterConnection()) {
          if (foundMaster(listener, protocol, searchFilter)) {
            return;
          }
        } else if (listener.isSecondaryHostFailReconnect() && !protocol.isMasterConnection()) {
          if (foundSecondary(listener, protocol, searchFilter)) {
            return;
          }
        } else {
          protocol.close();
        }

      } catch (SQLException e) {
        lastQueryException = e;
        listener.addToBlacklist(protocol.getHostAddress());
      }

      if (!listener.isMasterHostFailReconnect() && !listener.isSecondaryHostFailReconnect()) {
        return;
      }

      //in case master not found but slave is , and allowing master down
      if (loopAddresses.isEmpty()
          && (listener.isMasterHostFailReconnect()
          && listener.urlParser.getOptions().allowMasterDownConnection
          && !listener.isSecondaryHostFailReconnect())) {
        return;
      }

      //on connection and all slaves have been tested, use master if on
      if (loopAddresses.isEmpty()
          && searchFilter.isInitialConnection()
          && !listener.isMasterHostFailReconnect()) {
        return;
      }

      // if server has try to connect to all host, and there is remaining master or slave that fail
      // add all servers back to continue looping until maxConnectionTry is reached
      if (loopAddresses.isEmpty() && !searchFilter.isFailoverLoop() && maxConnectionTry > 0) {
        resetHostList(listener, loopAddresses);

        if (firstLoop) {
          firstLoop = false;
        } else {
          try {
            //wait 250ms before looping through all connection another time
            Thread.sleep(250);
          } catch (InterruptedException interrupted) {
            //interrupted, continue
          }
        }
      }

    }

    if (listener.isMasterHostFailReconnect() || listener.isSecondaryHostFailReconnect()) {
      String error = "No active connection found for replica";
      if (listener.isMasterHostFailReconnect()) {
        error = "No active connection found for master";
      }
      if (lastQueryException != null) {
        throw new SQLException(error + " : " + lastQueryException.getMessage(),
            lastQueryException.getSQLState(), lastQueryException.getErrorCode(),
            lastQueryException);
      }
      throw new SQLException(error);
    }

  }
138206
@Override
	public void connectionFreed(IManagedConnectionEvent<C> event) {
		// physical connection is already set free
		if (!event.getManagedConnection().hasCoreConnection()) {
			return;
		}
		C con = event.getManagedConnection().getCoreConnection();
		if (con == null || !(con instanceof IXADataRecorderAware)) {
			return;
		}

		IXADataRecorderAware messageAwareConnection = (IXADataRecorderAware) con;
		// Transaction is closed and the xaDataRecorder is destroyed ...
		IXADataRecorder xaDataRecorder = messageAwareConnection
				.getXADataRecorder();
		if (xaDataRecorder == null) {
			return;
		}

		// if commit/rollback was performed, nothing happend. If no the logged
		// data is closed but not destroy. So recovery can happen

		if (event.getManagedConnection().hasTransactionalData()) {
			xaRecorderRepository.close(); // close without removing the recover
											// data
		} else {
			xaDataRecorder.destroy();
		}
		messageAwareConnection.setXADataRecorder(null);

	}
1162330
private void readFreeSpaceMap(long freeSpaceCount)
                    throws ObjectManagerException
    {
        final String methodName = "readFreeSpaceMap";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName,
                        new Object[] { new Long(freeSpaceCount) });

        freeSpaceByAddressHead = null;
        freeSpaceByLength = new java.util.TreeSet(new AbstractSingleFileObjectStore.LengthComparator());
        // Load the free space map.
        if (freeSpaceStoreArea != null) {
            try {
                storeFile.seek(freeSpaceStoreArea.byteAddress);
                FreeSpace freeSpaceByAddressTail = null;
                for (int i = 0; i < freeSpaceCount; i++) {
                    AbstractSingleFileObjectStore.FreeSpace freeSpace =
                                    new AbstractSingleFileObjectStore.FreeSpace(storeFile.readLong(), storeFile.readLong());

                    // If we are switching to using a sorted free space map, then
                    // we may find the map we load from the store is unsorted.
                    // In this case we take a hit on sorting it during the first
                    // startup after it is enabled.
                    if (freeSpaceByAddressTail != null && freeSpace.address < freeSpaceByAddressTail.address) {
                        FreeSpace sortEntry = freeSpaceByAddressHead;
                        while (sortEntry != null) {
                            // Have we just gone past where this entry should be inserted?
                            if (sortEntry.address > freeSpace.address) {
                                // Add it before the current entry.
                                freeSpace.next = sortEntry;
                                freeSpace.prev = sortEntry.prev;
                                if (sortEntry.prev != null) {
                                    sortEntry.prev.next = freeSpace;
                                }
                                else {
                                    freeSpaceByAddressHead = freeSpace;
                                }
                                sortEntry.prev = freeSpace;
                                break;
                            }
                            sortEntry = sortEntry.next;
                        }
                        // Check we found a place to insert it
                        if (sortEntry == null) {
                            // No FFDC Code Needed.
                            Exception exception = new RuntimeException();
                            ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:365:1.35");
                            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                                trace.exit(this,
                                           cclass,
                                           "readFreeSpaceMap");
                            throw new UnexpectedExceptionException(this, exception);
                        }
                        // The tail remains unchanged in this case, as we can't get to this
                        // block unless there is already a tail, and our entry is before it.
                    }
                    // Otherwise we simply add this entry to the tail
                    else {
                        // Are we the first entry?
                        if (freeSpaceByAddressTail == null) {
                            freeSpaceByAddressHead = freeSpace;
                        }
                        else {
                            freeSpace.prev = freeSpaceByAddressTail;
                            freeSpaceByAddressTail.next = freeSpace;
                        }
                        // The tail is now our new entry
                        freeSpaceByAddressTail = freeSpace;
                    }

                    // Add the entry to the length-sorted list 
                    freeSpaceByLength.add(freeSpace);
                } // for directoryCount.

            } catch (java.io.IOException exception) {
                // No FFDC Code Needed.
                ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:395:1.35");

                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               methodName);

                // cannot continue
                objectManagerState.requestShutdown();
                throw new PermanentIOException(this,
                                               exception);
            } // catch (java.io.IOException exception).
        } // if (freeSpaceStoreArea != null).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
1109851
@Override
    public void free(AllocationPoint point, AllocationStatus target) {
        //if (point.getAllocationStatus() == AllocationStatus.DEVICE)
        //deviceAllocations.get(point.getDeviceId()).remove(point.getObjectId());

        //zeroAllocations.get(point.getBucketId()).remove(point.getObjectId());
        if (point.getAllocationStatus() == AllocationStatus.DEVICE)
            deviceMemoryTracker.subFromAllocation(Thread.currentThread().getId(), point.getDeviceId(),
                            AllocationUtils.getRequiredMemory(point.getShape()));

        memoryProvider.free(point);
    }
792998
protected void sendLocalAddress(Address local_addr) throws Exception {
        try {
            // write the cookie
            out.write(cookie, 0, cookie.length);

            // write the version
            out.writeShort(Version.version);
            out.writeShort(local_addr.serializedSize()); // address size
            local_addr.writeTo(out);
            out.flush(); // needed ?
            updateLastAccessed();
        }
        catch(Exception ex) {
            server.socket_factory.close(this.sock);
            connected=false;
            throw ex;
        }
    }
184270
public void setFreebase(String freebase) {
    if(freebase != null) {
      freebase = freebase.trim();
    }
    this.freebase = freebase;
  }
1350225
@Override
	public int countByCP_T(long CProductId, String type) {
		FinderPath finderPath = FINDER_PATH_COUNT_BY_CP_T;

		Object[] finderArgs = new Object[] { CProductId, type };

		Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(3);

			query.append(_SQL_COUNT_CPDEFINITIONLINK_WHERE);

			query.append(_FINDER_COLUMN_CP_T_CPRODUCTID_2);

			boolean bindType = false;

			if (type == null) {
				query.append(_FINDER_COLUMN_CP_T_TYPE_1);
			}
			else if (type.equals("")) {
				query.append(_FINDER_COLUMN_CP_T_TYPE_3);
			}
			else {
				bindType = true;

				query.append(_FINDER_COLUMN_CP_T_TYPE_2);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(CProductId);

				if (bindType) {
					qPos.add(type);
				}

				count = (Long)q.uniqueResult();

				finderCache.putResult(finderPath, finderArgs, count);
			}
			catch (Exception e) {
				finderCache.removeResult(finderPath, finderArgs);

				throw processException(e);
			}
			finally {
				closeSession(session);
			}
		}

		return count.intValue();
	}
890689
void updateCount() {
		if (this.hasChanged) {
			this.countArray = ArrayUtils.toPrimitive(getCountList().toArray(
					new Long[0]));
			this.hasChanged = false;
		}
	}
635265
static int compareAddresses(byte[] current, byte[] candidate) {
        if (candidate == null || candidate.length < EUI48_MAC_ADDRESS_LENGTH) {
            return 1;
        }

        // Must not be filled with only 0 and 1.
        boolean onlyZeroAndOne = true;
        for (byte b: candidate) {
            if (b != 0 && b != 1) {
                onlyZeroAndOne = false;
                break;
            }
        }

        if (onlyZeroAndOne) {
            return 1;
        }

        // Must not be a multicast address
        if ((candidate[0] & 1) != 0) {
            return 1;
        }

        // Prefer globally unique address.
        if ((candidate[0] & 2) == 0) {
            if (current.length != 0 && (current[0] & 2) == 0) {
                // Both current and candidate are globally unique addresses.
                return 0;
            } else {
                // Only candidate is globally unique.
                return -1;
            }
        } else {
            if (current.length != 0 && (current[0] & 2) == 0) {
                // Only current is globally unique.
                return 1;
            } else {
                // Both current and candidate are non-unique.
                return 0;
            }
        }
    }