List of usage examples for java.lang System identityHashCode
@HotSpotIntrinsicCandidate public static native int identityHashCode(Object x);
From source file:org.codebistro.jsonrpc.Client.java
public Object invoke(Object proxyObj, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (methodName.equals("hashCode")) { return new Integer(System.identityHashCode(proxyObj)); } else if (methodName.equals("equals")) { return (proxyObj == args[0] ? Boolean.TRUE : Boolean.FALSE); } else if (methodName.equals("toString")) { return proxyObj.getClass().getName() + '@' + Integer.toHexString(proxyObj.hashCode()); }/*ww w.j av a2 s. c o m*/ JSONObject message = new JSONObject(); String tag = proxyMap.get(proxyObj); String methodTag = tag == null ? "" : tag + "."; methodTag += methodName; message.put("method", methodTag); JSONArray params = new JSONArray(); if (args != null) { for (Object arg : args) { SerializerState state = new SerializerState(); params.put(message2Object.marshall(state, arg)); } } message.put("params", params); message.put("id", 1); JSONObject responseMessage = session.sendAndReceive(message); if (!responseMessage.has("result")) processException(responseMessage); Object rawResult = responseMessage.get("result"); if (rawResult == null) { processException(responseMessage); } Class<?> returnType = method.getReturnType(); if (returnType.equals(Void.TYPE)) return null; SerializerState state = new SerializerState(); return message2Object.unmarshall(state, returnType, rawResult); }
From source file:org.compass.core.transaction.LocalTransaction.java
public void begin() throws CompassException { if (log.isDebugEnabled()) { log.debug("Starting a new local transcation on thread [" + Thread.currentThread().getName() + "] Compass [" + System.identityHashCode(compass) + "] Session [" + System.identityHashCode(session) + "]"); }//from ww w . j av a 2s .c o m session.getSearchEngine().begin(); state = STARTED; }
From source file:com.github.dbourdette.glass.tools.UtilsTool.java
public String hash(Object object) { if (object == null) { return ""; }/*from w w w. j a va2 s . c om*/ return object.getClass().getSimpleName() + "-" + System.identityHashCode(object); }
From source file:at.ac.tuwien.infosys.jcloudscale.utility.ReferenceHashmap.java
@Override public V put(K key, V value) { int hash = System.identityHashCode(key); // add to key map List<WeakReference<K>> _keys = keys.get(hash); if (_keys == null) { _keys = new ArrayList<WeakReference<K>>(); keys.put(hash, _keys);/*from w w w. j a va 2s . co m*/ } _keys.add(new WeakReference<K>(key)); // add to value map List<Entry<WeakReference<K>, V>> _entries = values.get(hash); if (_entries == null) { _entries = new ArrayList<>(); values.put(hash, _entries); } _entries.add(new MapEntry<>(new WeakReference<K>(key), value)); size++; return null; }
From source file:org.apache.qpid.server.filter.JMSSelectorFilter.java
public boolean matches(Filterable message) { boolean match = _matcher.matches(wrap(message)); if (_logger.isDebugEnabled()) { _logger.debug(message + " match(" + match + ") selector(" + System.identityHashCode(_selector) + "):" + _selector);/*from w ww. j a v a2 s . c o m*/ } return match; }
From source file:chronos.web.controllers.IndexController.java
/** * @param model//from w w w . ja v a 2 s. c o m * {@link Model} */ @RequestMapping("/index.html") public final void index(final Model model) { model.addAttribute("now", new Date()); try { final StdSchedulerFactory factory = new StdSchedulerFactory(); factory.initialize(); final Scheduler scheduler = factory.getScheduler(); logger.debug("Got scheduler " + getUniqueIdentifier(scheduler.getSchedulerName(), scheduler.getSchedulerInstanceId()) + "@" + System.identityHashCode(scheduler)); model.addAttribute("jobGroups", extractJobGroups(scheduler)); model.addAttribute("triggerGroups", extractTriggers(scheduler)); } catch (final SchedulerException e) { logger.error(e.getMessage(), e); } }
From source file:gridool.util.GridUtils.java
@Nonnull public static String generateJobId(@Nonnull String localNodeId, @Nonnull GridJob job) { final long time = System.nanoTime(); final int hashcode = System.identityHashCode(job); long tid = Thread.currentThread().getId(); return localNodeId + '#' + Long.toString(time) + '/' + Integer.toString(hashcode) + 'T' + Long.toString(tid); }
From source file:org.springmodules.cache.interceptor.MetadataCacheAttributeSource.java
private String key(Method m, Class t) { return t.toString() + System.identityHashCode(m); }
From source file:org.ops4j.gaderian.impl.ShutdownCoordinatorImpl.java
private void shutdown(RegistryShutdownListener s) { if (alreadyShutdown == null) { alreadyShutdown = new HashSet(); }// w ww. j a va2 s .co m final Long id = new Long(System.identityHashCode(s)); if (!alreadyShutdown.contains(id)) { try { s.registryDidShutdown(); } catch (RuntimeException ex) { _log.error(ImplMessages.shutdownCoordinatorFailure(s, ex), ex); } finally { alreadyShutdown.add(id); } } }
From source file:org.apache.mnemonic.collections.DurableSinglyLinkedListNGTest.java
@BeforeClass public void setUp() { m_rand = Utils.createRandom();/*from ww w .j a va 2s .c o m*/ m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024, "./pobj_NodeValue.dat", true); cKEYCAPACITY = m_act.handlerCapacity(); m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() { @Override public boolean reclaim(ByteBuffer mres, Long sz) { System.out.println(String.format("Reclaim Memory Buffer: %X Size: %s", System.identityHashCode(mres), null == sz ? "NULL" : sz.toString())); return false; } }); m_act.setChunkReclaimer(new Reclaim<Long>() { @Override public boolean reclaim(Long mres, Long sz) { System.out.println(String.format("Reclaim Memory Chunk: %X Size: %s", System.identityHashCode(mres), null == sz ? "NULL" : sz.toString())); return false; } }); for (long i = 0; i < cKEYCAPACITY; ++i) { m_act.setHandler(i, 0L); } }