List of usage examples for java.lang System identityHashCode
@HotSpotIntrinsicCandidate public static native int identityHashCode(Object x);
From source file:org.apache.kylin.cube.CubeManager.java
public static CubeManager getInstance(KylinConfig config) { CubeManager r = CACHE.get(config);//from ww w . j a v a 2 s . com if (r != null) { return r; } synchronized (CubeManager.class) { r = CACHE.get(config); if (r != null) { return r; } try { r = new CubeManager(config); CACHE.put(config, r); if (CACHE.size() > 1) { logger.warn("More than one singleton exist"); for (KylinConfig kylinConfig : CACHE.keySet()) { logger.warn("type: " + kylinConfig.getClass() + " reference: " + System.identityHashCode(kylinConfig.base())); } } return r; } catch (IOException e) { throw new IllegalStateException("Failed to init CubeManager from " + config, e); } } }
From source file:com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJobAlertImpl.java
protected static void attachException(MimeMessageHelper messageHelper, ExceptionInfo exceptionInfo) throws MessagingException { Throwable exception = exceptionInfo.getException(); if (exception == null) { return;//from w w w .ja v a2 s .co m } ByteArrayOutputStream bufOut = new ByteArrayOutputStream(); PrintStream printOut = new PrintStream(bufOut); exception.printStackTrace(printOut); printOut.flush(); String attachmentName = "exception_" + System.identityHashCode(exception) + ".txt"; messageHelper.addAttachment(attachmentName, new ByteArrayResource(bufOut.toByteArray())); }
From source file:org.diorite.scheduler.TaskBuilder.java
/** * Change name of task, you don't need set it, it isn't used by any important code. <br> * It may be used by some statisitc/timing systems. * * @param name new name of task./* w ww. jav a2s. c o m*/ * * @return this same task builder for chaining method. */ public TaskBuilder name(final String name) { this.name = name + "@" + System.identityHashCode(this.runnable); return this; }
From source file:org.jabsorb.ng.client.Client.java
/** * This method is public because of the inheritance from the * InvokationHandler -- <b>should never be called directly.</b> *///from w ww .ja va2 s .com @Override public Object invoke(final Object proxyObj, final Method method, final Object[] args) throws Throwable { final 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()); } return invoke(pProxyMap.get(proxyObj), method.getName(), args, method.getReturnType()); }
From source file:com.taobao.tddl.common.config.impl.DefaultConfigDataHandlerFactory.java
public static String objectId(Object o) { if (o == null) { return "null"; } else {/*from w w w .j a v a2 s .co m*/ // System.identityHashCode // return o.getClass().getName() + "@" + System.identityHashCode(o); } }
From source file:org.envirocar.app.application.service.BackgroundServiceImpl.java
@Override public void onCreate() { logger.info("onCreate " + getClass().getName() + "; Hash: " + System.identityHashCode(this)); tts = new TextToSpeech(getApplicationContext(), new TextToSpeechListener()); toastHandler = new Handler(); }
From source file:org.jgentleframework.utils.ObjectUtils.java
/** * Return a hex String form of an object's identity hash code. * //from w w w. j ava 2 s . co m * @param obj * the object * @return the object's identity code in hex notation */ public static String getIdentityHexString(Object obj) { return Integer.toHexString(System.identityHashCode(obj)); }
From source file:IdentityIntMap.java
/** * Expands the property table//from w w w. j av a 2 s. co m */ private void resize(int newSize) { Object[] newKeys = new Object[newSize]; int[] newValues = new int[newSize]; int mask = _mask = newKeys.length - 1; Object[] keys = _keys; int values[] = _values; for (int i = keys.length - 1; i >= 0; i--) { Object key = keys[i]; if (key == null || key == DELETED) continue; int hash = System.identityHashCode(key) % mask & mask; while (true) { if (newKeys[hash] == null) { newKeys[hash] = key; newValues[hash] = values[i]; break; } hash = (hash + 1) % mask; } } _keys = newKeys; _values = newValues; }
From source file:edu.oregonstate.eecs.mcplan.domains.blackjack.Experiments.java
private static <X extends Representation<BlackjackState>, R extends Representer<BlackjackState, X>> void runExperiment( final R repr, final BlackjackParameters params, final int Nepisodes, final double p, final int Ngames, final PrintStream data_out) { System.out.println("****************************************"); System.out.println(/*from w w w . j av a2s .co m*/ "game = " + params.max_score + " x " + Ngames + ": " + repr + " x " + Nepisodes + ", p = " + p); final MctsVisitor<BlackjackState, BlackjackAction> visitor = new DefaultMctsVisitor<BlackjackState, BlackjackAction>(); final ActionGenerator<BlackjackState, JointAction<BlackjackAction>> action_gen = new BlackjackJointActionGenerator( 1); final double c = 1.0; final int rollout_width = 1; final int rollout_depth = Integer.MAX_VALUE; final double discount = 1.0; // Optimistic default value final double[] default_value = new double[] { 1.0 }; final BackupRule<X, BlackjackAction> backup = BackupRule.<X, BlackjackAction>MaxQ(); final MeanVarianceAccumulator ret = new MeanVarianceAccumulator(); for (int i = 0; i < Ngames; ++i) { if (i % 100000 == 0) { System.out.println("Episode " + i); } final Deck deck = new InfiniteDeck(); final BlackjackSimulator sim = new BlackjackSimulator(deck, 1, params); final Policy<BlackjackState, JointAction<BlackjackAction>> rollout_policy = new RandomPolicy<BlackjackState, JointAction<BlackjackAction>>( 0 /*Player*/, rng.nextInt(), action_gen.create()); final EvaluationFunction<BlackjackState, BlackjackAction> rollout_evaluator = RolloutEvaluator .create(rollout_policy, discount, rollout_width, rollout_depth); final GameTreeFactory<BlackjackState, X, BlackjackAction> factory = new UctSearch.Factory<BlackjackState, X, BlackjackAction>( sim, base_repr.create(), action_gen, c, Nepisodes, rng, rollout_evaluator, backup, default_value); final SearchPolicy<BlackjackState, X, BlackjackAction> search_policy = new SearchPolicy<BlackjackState, X, BlackjackAction>( factory, visitor, null) { @Override protected JointAction<BlackjackAction> selectAction(final GameTree<X, BlackjackAction> tree) { return BackupRules.MaxAction(tree.root()).a(); } @Override public int hashCode() { return System.identityHashCode(this); } @Override public boolean equals(final Object that) { return this == that; } }; final Episode<BlackjackState, BlackjackAction> episode = new Episode<BlackjackState, BlackjackAction>( sim, search_policy); episode.run(); // System.out.println( sim.state().token().toString() ); // System.out.println( "Reward: " + sim.reward()[0] ); ret.add(sim.reward()[0]); } System.out.println("****************************************"); System.out.println("Average return: " + ret.mean()); System.out.println("Return variance: " + ret.variance()); final double conf = 1.96 * Math.sqrt(ret.variance()) / Math.sqrt(Ngames); System.out.println("Confidence: " + conf); System.out.println(); data_out.print(repr); data_out.print("," + params.max_score); data_out.print("," + Ngames); data_out.print("," + Nepisodes); data_out.print("," + p); data_out.print("," + ret.mean()); data_out.print("," + ret.variance()); data_out.print("," + conf); data_out.println(); }
From source file:org.apache.geode.internal.process.ProcessStreamReader.java
@Override public String toString() { StringBuilder sb = new StringBuilder(getClass().getSimpleName()); sb.append(" Thread").append(" #").append(System.identityHashCode(this)); sb.append(" alive=").append(isRunning()); sb.append(" listener=").append(inputListener); return sb.toString(); }