List of usage examples for java.lang System identityHashCode
@HotSpotIntrinsicCandidate public static native int identityHashCode(Object x);
From source file:com.chuhan.privatecalc.fragment.os.FragmentActivity.java
/** * Print the Activity's state into the given stream. This gets invoked if * you run "adb shell dumpsys activity <activity_component_name>". * * @param prefix Desired prefix to prepend at each line of output. * @param fd The raw file descriptor that the dump is being sent to. * @param writer The PrintWriter to which you should dump your state. This will be * closed for you after you return.//from w ww . java 2s .c om * @param args additional arguments to the dump request. */ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { if (android.os.Build.VERSION.SDK_INT >= HONEYCOMB) { // XXX This can only work if we can call the super-class impl. :/ //ActivityCompatHoneycomb.dump(this, prefix, fd, writer, args); } writer.print(prefix); writer.print("Local FragmentActivity "); writer.print(Integer.toHexString(System.identityHashCode(this))); writer.println(" State:"); String innerPrefix = prefix + " "; writer.print(innerPrefix); writer.print("mCreated="); writer.print(mCreated); writer.print("mResumed="); writer.print(mResumed); writer.print(" mStopped="); writer.print(mStopped); writer.print(" mReallyStopped="); writer.println(mReallyStopped); writer.print(innerPrefix); writer.print("mLoadersStarted="); writer.println(mLoadersStarted); if (mLoaderManager != null) { writer.print(prefix); writer.print("Loader Manager "); writer.print(Integer.toHexString(System.identityHashCode(mLoaderManager))); writer.println(":"); mLoaderManager.dump(prefix + " ", fd, writer, args); } mFragments.dump(prefix, fd, writer, args); writer.print(prefix); writer.println("View Hierarchy:"); dumpViewHierarchy(prefix + " ", writer, getWindow().getDecorView()); }
From source file:it.staiger.jmeter.protocol.http.sampler.HTTPHC4DynamicFilePost.java
private HttpClient setupClient(URL url, SampleResult res) { Map<HttpClientKey, HttpClient> mapHttpClientPerHttpClientKey = HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY .get();//from w w w . j a v a 2 s. co m final String host = url.getHost(); final String proxyHost = getProxyHost(); final int proxyPort = getProxyPortInt(); boolean useStaticProxy = isStaticProxy(host); boolean useDynamicProxy = isDynamicProxy(proxyHost, proxyPort); // Lookup key - must agree with all the values used to create the HttpClient. HttpClientKey key = new HttpClientKey(url, (useStaticProxy || useDynamicProxy), useDynamicProxy ? proxyHost : PROXY_HOST, useDynamicProxy ? proxyPort : PROXY_PORT, useDynamicProxy ? getProxyUser() : PROXY_USER, useDynamicProxy ? getProxyPass() : PROXY_PASS); HttpClient httpClient = mapHttpClientPerHttpClientKey.get(key); if (httpClient != null && resetSSLContext && HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(url.getProtocol())) { ((AbstractHttpClient) httpClient).clearRequestInterceptors(); ((AbstractHttpClient) httpClient).clearResponseInterceptors(); httpClient.getConnectionManager().closeIdleConnections(1L, TimeUnit.MICROSECONDS); httpClient = null; JsseSSLManager sslMgr = (JsseSSLManager) SSLManager.getInstance(); sslMgr.resetContext(); resetSSLContext = false; } if (httpClient == null) { // One-time init for this client HttpParams clientParams = new DefaultedHttpParams(new BasicHttpParams(), DEFAULT_HTTP_PARAMS); DnsResolver resolver = this.testElement.getDNSResolver(); if (resolver == null) { resolver = new SystemDefaultDnsResolver(); } ClientConnectionManager connManager = new MeasuringConnectionManager( SchemeRegistryFactory.createDefault(), resolver); httpClient = new DefaultHttpClient(connManager, clientParams) { @Override protected HttpRequestRetryHandler createHttpRequestRetryHandler() { return new DefaultHttpRequestRetryHandler(RETRY_COUNT, false); // set retry count } }; if (IDLE_TIMEOUT > 0) { ((AbstractHttpClient) httpClient).setKeepAliveStrategy(IDLE_STRATEGY); } ((AbstractHttpClient) httpClient).addResponseInterceptor(new ResponseContentEncoding()); ((AbstractHttpClient) httpClient).addResponseInterceptor(METRICS_SAVER); // HACK ((AbstractHttpClient) httpClient).addRequestInterceptor(METRICS_RESETTER); // Override the defualt schemes as necessary SchemeRegistry schemeRegistry = httpClient.getConnectionManager().getSchemeRegistry(); if (SLOW_HTTP != null) { schemeRegistry.register(SLOW_HTTP); } if (HTTPS_SCHEME != null) { schemeRegistry.register(HTTPS_SCHEME); } // Set up proxy details if (useDynamicProxy) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); clientParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); String proxyUser = getProxyUser(); if (proxyUser.length() > 0) { ((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials( new AuthScope(proxyHost, proxyPort), new NTCredentials(proxyUser, getProxyPass(), localHost, PROXY_DOMAIN)); } } else if (useStaticProxy) { HttpHost proxy = new HttpHost(PROXY_HOST, PROXY_PORT); clientParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); if (PROXY_USER.length() > 0) { ((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials( new AuthScope(PROXY_HOST, PROXY_PORT), new NTCredentials(PROXY_USER, PROXY_PASS, localHost, PROXY_DOMAIN)); } } // Bug 52126 - we do our own cookie handling clientParams.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES); if (log.isDebugEnabled()) { log.debug("Created new HttpClient: @" + System.identityHashCode(httpClient) + " " + key.toString()); } mapHttpClientPerHttpClientKey.put(key, httpClient); // save the agent for next time round } else { if (log.isDebugEnabled()) { log.debug("Reusing the HttpClient: @" + System.identityHashCode(httpClient) + " " + key.toString()); } } MeasuringConnectionManager connectionManager = (MeasuringConnectionManager) httpClient .getConnectionManager(); connectionManager.setSample(res); // TODO - should this be done when the client is created? // If so, then the details need to be added as part of HttpClientKey setConnectionAuthorization(httpClient, url, getAuthManager(), key); return httpClient; }
From source file:gdsc.smlm.ij.plugins.DensityImage.java
/** * Compute the Ripley's L-function for user selected radii and show it on a plot. * /* w w w .ja v a 2s .co m*/ * @param results */ private void computeRipleysPlot(MemoryPeakResults results) { GenericDialog gd = new GenericDialog(TITLE); gd.addMessage("Compute Ripley's L(r) - r plot"); gd.addNumericField("Min_radius", minR, 2); gd.addNumericField("Max_radius", maxR, 2); gd.addNumericField("Increment", incrementR, 2); gd.addCheckbox("Confidence_intervals", confidenceIntervals); gd.showDialog(); if (gd.wasCanceled()) return; minR = gd.getNextNumber(); maxR = gd.getNextNumber(); incrementR = gd.getNextNumber(); confidenceIntervals = gd.getNextBoolean(); if (minR > maxR || incrementR < 0 || gd.invalidNumber()) { IJ.error(TITLE, "Invalid radius parameters"); return; } DensityManager dm = new DensityManager(results); double[][] values = calculateLScores(dm); // 99% confidence intervals final int iterations = (confidenceIntervals) ? 99 : 0; double[] upper = null; double[] lower = null; Rectangle bounds = results.getBounds(); // Use a uniform distribution for the coordinates HaltonSequenceGenerator dist = new HaltonSequenceGenerator(2); dist.skipTo(new Well19937c(System.currentTimeMillis() + System.identityHashCode(this)).nextInt()); for (int i = 0; i < iterations; i++) { IJ.showProgress(i, iterations); IJ.showStatus(String.format("L-score confidence interval %d / %d", i + 1, iterations)); // Randomise coordinates float[] x = new float[results.size()]; float[] y = new float[x.length]; for (int j = x.length; j-- > 0;) { final double[] d = dist.nextVector(); x[j] = (float) (d[0] * bounds.width); y[j] = (float) (d[1] * bounds.height); } double[][] values2 = calculateLScores(new DensityManager(x, y, bounds)); if (upper == null) { upper = values2[1]; lower = new double[upper.length]; System.arraycopy(upper, 0, lower, 0, upper.length); } else { for (int m = upper.length; m-- > 0;) { if (upper[m] < values2[1][m]) upper[m] = values2[1][m]; if (lower[m] > values2[1][m]) lower[m] = values2[1][m]; } } } String title = results.getName() + " Ripley's (L(r) - r) / r"; Plot2 plot = new Plot2(title, "Radius", "(L(r) - r) / r", values[0], values[1]); // Get the limits double yMin = min(0, values[1]); double yMax = max(0, values[1]); if (iterations > 0) { yMin = min(yMin, lower); yMax = max(yMax, upper); } plot.setLimits(0, values[0][values[0].length - 1], yMin, yMax); if (iterations > 0) { plot.setColor(Color.BLUE); plot.addPoints(values[0], upper, 1); plot.setColor(Color.RED); plot.addPoints(values[0], lower, 1); plot.setColor(Color.BLACK); } Utils.display(title, plot); }
From source file:android.app.FragmentManager.java
@Override public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("FragmentManager{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(" in "); if (mParent != null) { DebugUtils.buildShortClassTag(mParent, sb); } else {/* ww w .ja v a2 s . c o m*/ DebugUtils.buildShortClassTag(mActivity, sb); } sb.append("}}"); return sb.toString(); }
From source file:com.tencent.tws.assistant.support.v4.app.TwsFragmentActivity.java
/** * Print the Activity's state into the given stream. This gets invoked if * you run "adb shell dumpsys activity <activity_component_name>". * * @param prefix Desired prefix to prepend at each line of output. * @param fd The raw file descriptor that the dump is being sent to. * @param writer The PrintWriter to which you should dump your state. This will be * closed for you after you return./*from w w w . j av a 2s. c o m*/ * @param args additional arguments to the dump request. */ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { if (android.os.Build.VERSION.SDK_INT >= HONEYCOMB) { // XXX This can only work if we can call the super-class impl. :/ //ActivityCompatHoneycomb.dump(this, prefix, fd, writer, args); } writer.print(prefix); writer.print("Local TwsFragmentActivity "); writer.print(Integer.toHexString(System.identityHashCode(this))); writer.println(" State:"); String innerPrefix = prefix + " "; writer.print(innerPrefix); writer.print("mCreated="); writer.print(mCreated); writer.print("mResumed="); writer.print(mResumed); writer.print(" mStopped="); writer.print(mStopped); writer.print(" mReallyStopped="); writer.println(mReallyStopped); writer.print(innerPrefix); writer.print("mLoadersStarted="); writer.println(mLoadersStarted); if (mLoaderManager != null) { writer.print(prefix); writer.print("Loader Manager "); writer.print(Integer.toHexString(System.identityHashCode(mLoaderManager))); writer.println(":"); mLoaderManager.dump(prefix + " ", fd, writer, args); } mFragments.dump(prefix, fd, writer, args); writer.print(prefix); writer.println("View Hierarchy:"); dumpViewHierarchy(prefix + " ", writer, getWindow().getDecorView()); }
From source file:org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhaseBase.java
/** * {@inheritDoc}//from www. j ava 2 s .c om */ @Override public String toString() { StringBuilder sb = new StringBuilder(); Queue<ViewLifecyclePhase> toPrint = new LinkedList<ViewLifecyclePhase>(); toPrint.offer(this); while (!toPrint.isEmpty()) { ViewLifecyclePhase tp = toPrint.poll(); if (tp.getElement() == null) { sb.append("\n "); sb.append(tp.getClass().getSimpleName()); sb.append(" (recycled)"); continue; } String indent; if (tp == this) { sb.append("\nProcessed? "); sb.append(processed); indent = "\n"; } else { indent = "\n "; } sb.append(indent); sb.append(tp.getClass().getSimpleName()); sb.append(" "); sb.append(System.identityHashCode(tp)); sb.append(" "); sb.append(tp.getViewPath()); sb.append(" "); sb.append(tp.getElement().getClass().getSimpleName()); sb.append(" "); sb.append(tp.getElement().getId()); sb.append(" "); sb.append(pendingSuccessors); if (tp == this) { sb.append("\nPredecessor Phases:"); } ViewLifecyclePhase tpredecessor = tp.getPredecessor(); if (tpredecessor != null) { toPrint.add(tpredecessor); } } return sb.toString(); }
From source file:android.app.FragmentManager.java
@Override public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { String innerPrefix = prefix + " "; int N;/*from w ww .j av a 2 s.c o m*/ if (mActive != null) { N = mActive.size(); if (N > 0) { writer.print(prefix); writer.print("Active Fragments in "); writer.print(Integer.toHexString(System.identityHashCode(this))); writer.println(":"); for (int i = 0; i < N; i++) { Fragment f = mActive.get(i); writer.print(prefix); writer.print(" #"); writer.print(i); writer.print(": "); writer.println(f); if (f != null) { f.dump(innerPrefix, fd, writer, args); } } } } if (mAdded != null) { N = mAdded.size(); if (N > 0) { writer.print(prefix); writer.println("Added Fragments:"); for (int i = 0; i < N; i++) { Fragment f = mAdded.get(i); writer.print(prefix); writer.print(" #"); writer.print(i); writer.print(": "); writer.println(f.toString()); } } } if (mCreatedMenus != null) { N = mCreatedMenus.size(); if (N > 0) { writer.print(prefix); writer.println("Fragments Created Menus:"); for (int i = 0; i < N; i++) { Fragment f = mCreatedMenus.get(i); writer.print(prefix); writer.print(" #"); writer.print(i); writer.print(": "); writer.println(f.toString()); } } } if (mBackStack != null) { N = mBackStack.size(); if (N > 0) { writer.print(prefix); writer.println("Back Stack:"); for (int i = 0; i < N; i++) { BackStackRecord bs = mBackStack.get(i); writer.print(prefix); writer.print(" #"); writer.print(i); writer.print(": "); writer.println(bs.toString()); bs.dump(innerPrefix, fd, writer, args); } } } synchronized (this) { if (mBackStackIndices != null) { N = mBackStackIndices.size(); if (N > 0) { writer.print(prefix); writer.println("Back Stack Indices:"); for (int i = 0; i < N; i++) { BackStackRecord bs = mBackStackIndices.get(i); writer.print(prefix); writer.print(" #"); writer.print(i); writer.print(": "); writer.println(bs); } } } if (mAvailBackStackIndices != null && mAvailBackStackIndices.size() > 0) { writer.print(prefix); writer.print("mAvailBackStackIndices: "); writer.println(Arrays.toString(mAvailBackStackIndices.toArray())); } } if (mPendingActions != null) { N = mPendingActions.size(); if (N > 0) { writer.print(prefix); writer.println("Pending Actions:"); for (int i = 0; i < N; i++) { Runnable r = mPendingActions.get(i); writer.print(prefix); writer.print(" #"); writer.print(i); writer.print(": "); writer.println(r); } } } writer.print(prefix); writer.println("FragmentManager misc state:"); writer.print(prefix); writer.print(" mActivity="); writer.println(mActivity); writer.print(prefix); writer.print(" mContainer="); writer.println(mContainer); if (mParent != null) { writer.print(prefix); writer.print(" mParent="); writer.println(mParent); } writer.print(prefix); writer.print(" mCurState="); writer.print(mCurState); writer.print(" mStateSaved="); writer.print(mStateSaved); writer.print(" mDestroyed="); writer.println(mDestroyed); if (mNeedMenuInvalidate) { writer.print(prefix); writer.print(" mNeedMenuInvalidate="); writer.println(mNeedMenuInvalidate); } if (mNoTransactionsBecause != null) { writer.print(prefix); writer.print(" mNoTransactionsBecause="); writer.println(mNoTransactionsBecause); } if (mAvailIndices != null && mAvailIndices.size() > 0) { writer.print(prefix); writer.print(" mAvailIndices: "); writer.println(Arrays.toString(mAvailIndices.toArray())); } }
From source file:com.mellanox.r4h.DataXceiverBase.java
private void processPacketReply(Msg msg) throws IOException { boolean readAckfields = false; Msg origMsg = msg.getMirror(false);/*from w w w . j a v a 2 s. c o m*/ PacketMessageContext pmc = PacketMessageContext.getPacketMessageContext(origMsg); if (LOG.isTraceEnabled()) { LOG.trace("origMsg isMirror=" + origMsg.getIsMirror()); } long expected = PipelineAck.UNKOWN_SEQNO; long seqno = PipelineAck.UNKOWN_SEQNO; R4HPipelineAck ack = new R4HPipelineAck(); try { msg.getIn().position(0); ack.readFields(new DataInputStream(new ByteBufferInputStream(msg.getIn()))); readAckfields = true; if (LOG.isDebugEnabled()) { LOG.debug("PacketResponder " + oprHeader.getNumTargets() + " for block " + blockReceiver.getBlock() + " got " + ack); } msg.getOut().position(0); seqno = ack.getSeqno(); expected = pmc.getSeqno(); boolean isLastPkt = pmc.isLastPacketInBlock(); // verify seqno if (seqno != expected) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("MSG user context: msg ref=%s , context ref=%s", Integer.toHexString(System.identityHashCode(msg)), Integer.toHexString(System.identityHashCode(msg.getUserContext())))); } throw new IOException("PacketResponder " + oprHeader.getNumTargets() + " for block " + oprHeader.getBlock() + " expected seqno:" + expected + " received:" + seqno); } // If this is the last packet in block, then close block // file and finalize the block before responding success if (isLastPkt) { blockReceiver.finalizeBlock(); asyncCloseClientSession(); } PipelineAck ackReadyForReply = preparePipelineAck(origMsg, expected, ack, SUCCESS); pmc.setMessageAck(ackReadyForReply); } catch (Throwable e) { LOG.error("Failed during processing packet reply: " + blockReceiver.getBlock() + " " + oprHeader.getNumTargets() + " Exception " + StringUtils.stringifyException(e)); if ((clientSession != null) && (!clientSession.getIsClosing())) { asyncCloseClientSession(); } } finally { if (serverSession != null) { if (!readAckfields) { PipelineAck brokenPipelineError = prepareBrokenPipelineAck(origMsg, expected); pmc.setMessageAck(brokenPipelineError); } else if ((clientSession == null) && (!pmc.isLastPacketInBlock())) { PipelineAck errorAck = preparePipelineAck(origMsg, expected, ack, ERROR); pmc.setMessageAck(errorAck); } } int refCount = pmc.decrementReferenceCounter(); if (refCount == 0) { msgCallbacks.onMessageAction(origMsg); } } }
From source file:org.archive.bdb.BdbModule.java
/** * Creates a database-backed TempStoredSortedMap for transient * reporting requirements. Calling the returned map's destroy() * method when done discards the associated Database. * /* w ww . jav a2 s .co m*/ * @param <K> * @param <V> * @param dbName Database name to use; if null a name will be synthesized * @param keyClass Class of keys; should be a Java primitive type * @param valueClass Class of values; may be any serializable type * @param allowDuplicates whether duplicate keys allowed * @return */ public <K, V> DisposableStoredSortedMap<K, V> getStoredMap(String dbName, Class<K> keyClass, Class<V> valueClass, boolean allowDuplicates, boolean usePriorData) { BdbConfig config = new BdbConfig(); config.setSortedDuplicates(allowDuplicates); config.setAllowCreate(!usePriorData); Database mapDb; if (dbName == null) { dbName = "tempMap-" + System.identityHashCode(this) + "-" + sn; sn++; } final String openName = dbName; try { mapDb = openDatabase(openName, config, usePriorData); } catch (DatabaseException e) { throw new RuntimeException(e); } EntryBinding<V> valueBinding = TupleBinding.getPrimitiveBinding(valueClass); if (valueBinding == null) { valueBinding = new SerialBinding<V>(classCatalog, valueClass); } DisposableStoredSortedMap<K, V> storedMap = new DisposableStoredSortedMap<K, V>(mapDb, TupleBinding.getPrimitiveBinding(keyClass), valueBinding, true) { @Override public void dispose() { super.dispose(); DatabasePlusConfig dpc = BdbModule.this.databases.remove(openName); if (dpc == null) { BdbModule.LOGGER.log(Level.WARNING, "No such database: " + openName); } } }; return storedMap; }
From source file:org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhaseBase.java
/** * Logs a trace message related to processing this lifecycle, when tracing is active and * debugging is enabled.// w w w . j a v a 2 s . c o m * * @param step The step in processing the phase that has been reached. * @see ViewLifecycle#isTrace() */ protected void trace(String step) { if (ViewLifecycle.isTrace() && LOG.isDebugEnabled()) { String msg = System.identityHashCode(this) + " " + getClass() + " " + step + " " + path + " " + (element == null ? "(recycled)" : element.getClass() + " " + element.getId()); LOG.debug(msg); } }