List of usage examples for java.lang System identityHashCode
@HotSpotIntrinsicCandidate public static native int identityHashCode(Object x);
From source file:org.envirocar.app.application.service.BackgroundServiceImpl.java
@Override public boolean onUnbind(Intent intent) { logger.info("onUnbind " + getClass().getName() + "; Hash: " + System.identityHashCode(this)); return super.onUnbind(intent); }
From source file:com.heisenberg.impl.instance.WorkflowInstanceImpl.java
public String toString() { return "(" + (id != null ? id.toString() : Integer.toString(System.identityHashCode(this))) + "|wi)"; }
From source file:nz.co.senanque.vaadinsupport.application.MaduraSessionManager.java
private void registerWidget(AbstractField field) { int key = System.identityHashCode(field); if (m_fields.get(key) == null) { m_fields.put(key, field);/* ww w . ja v a2s . com*/ // logger.debug("MaduraSessionManager {} Registering field {} {}",getValidationEngine().getIdentifier(),key,field.getCaption()); } }
From source file:edu.wisc.my.portlets.bookmarks.domain.Folder.java
/** * @see java.lang.Object#equals(Object)/*from w ww. j a v a 2 s. co m*/ */ public boolean equals(final Object object) { final Set<Integer> visited = equalsVisitedFolder.getSet(); final int identityHash = System.identityHashCode(this); try { if (!visited.add(identityHash)) { visited.clear(); throw new IllegalStateException("A loop exists in the Folder tree."); } if (object == this) { return true; } if (!(object instanceof Folder)) { return false; } Folder rhs = (Folder) object; return new EqualsBuilder().appendSuper(super.equals(object)).append(this.children, rhs.children) .append(this.minimized, rhs.minimized).isEquals(); } finally { visited.remove(identityHash); } }
From source file:com.auditbucket.engine.repo.neo4j.model.ChangeLogNode.java
public int hashCode() { return id == null ? System.identityHashCode(this) : id.hashCode(); }
From source file:org.betaconceptframework.astroboa.resourceapi.locator.RepositoryLocator.java
@Path("{repositoryId}") public ResourceLocator connectToAstroboaRepository(@HeaderParam("Authorization") String authorization, @PathParam("repositoryId") String repositoryId, @Context ServletContext servletContext) { if (StringUtils.isBlank(repositoryId)) { throw new WebApplicationException(HttpURLConnection.HTTP_NOT_FOUND); }/* w ww .j ava 2 s .c om*/ try { AstroboaClient astroboaClient = null; long start = System.currentTimeMillis(); if (authorization != null) { String cacheKey = authorization + repositoryId; astroboaClient = AstroboaClientCache.Instance.get(cacheKey); if (astroboaClient == null) { String encodedUsernamePass = authorization.substring(5); String usernamePass = Base64.base64Decode(encodedUsernamePass); String[] usernamePassSplitted = usernamePass.split(":"); if (usernamePassSplitted.length == 2) { astroboaClient = new AstroboaClient(AstroboaClient.INTERNAL_CONNECTION); AstroboaCredentials credentials = new AstroboaCredentials(usernamePassSplitted[0], usernamePassSplitted[1]); astroboaClient.login(repositoryId, credentials); astroboaClient = AstroboaClientCache.Instance.cache(astroboaClient, cacheKey); } else { logger.error( "provided authorization in header (BASIC AUTH) cannot be decoded to username and password. Encoded Authorization String found in header is: " + authorization); throw new WebApplicationException(HttpURLConnection.HTTP_UNAUTHORIZED); } } } else { // login as anonymous final String anonymousCacheKey = repositoryId + IdentityPrincipal.ANONYMOUS; astroboaClient = AstroboaClientCache.Instance.get(anonymousCacheKey); if (astroboaClient == null) { astroboaClient = new AstroboaClient(AstroboaClient.INTERNAL_CONNECTION); String permanentKey = retrievePermanentKeyForAnonymousUser(repositoryId, servletContext); astroboaClient.loginAsAnonymous(repositoryId, permanentKey); astroboaClient = AstroboaClientCache.Instance.cache(astroboaClient, anonymousCacheKey); } } logger.debug("Retrieve/Create astroboa repository client {} in {}", System.identityHashCode(astroboaClient), DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - start)); return new ResourceLocator(astroboaClient); } catch (CmsInvalidPasswordException e) { logger.error("Login to Astroboa Repository was not successfull"); throw new WebApplicationException(HttpURLConnection.HTTP_UNAUTHORIZED); } catch (Exception e) { logger.error("A problem occured while connecting repository client to Astroboa Repository", e); throw new WebApplicationException(HttpURLConnection.HTTP_NOT_FOUND); } }
From source file:com.heisenberg.impl.definition.WorkflowImpl.java
public String toString() { return id != null ? id.toString() : Integer.toString(System.identityHashCode(this)); }
From source file:IdentityIntMap.java
/** * Puts a new value in the property table with the appropriate flags *///from w ww . jav a 2s .com public int put(Object key, int value) { int mask = _mask; int hash = System.identityHashCode(key) % mask & mask; Object[] keys = _keys; while (true) { Object testKey = keys[hash]; if (testKey == null || testKey == DELETED) { keys[hash] = key; _values[hash] = value; _size++; if (keys.length <= 4 * _size) resize(4 * keys.length); return NULL; } else if (key != testKey) { hash = (hash + 1) % mask; continue; } else { int old = _values[hash]; _values[hash] = value; return old; } } }
From source file:com.ayuget.redface.ui.fragment.PostsFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable final Bundle savedInstanceState) { Log.d(LOG_TAG, String.format("@%d -> Fragment(currentPage=%d) -> onCreateView(page=%d)", System.identityHashCode(this), currentPage, currentPage)); final View rootView = inflateRootView(R.layout.fragment_posts, inflater, container); // Default view is the loading indicator showLoadingIndicator();/*from w w w.ja v a 2s. c o m*/ // Restore the list of posts when the fragment is recreated by the framework restoredPosts = false; if (savedInstanceState != null) { Log.d(LOG_TAG, String.format("@%d -> Fragment(currentPage=%d) -> trying to restore state", System.identityHashCode(this), currentPage)); displayedPosts = savedInstanceState.getParcelableArrayList(ARG_POST_LIST); if (displayedPosts != null) { Log.i(LOG_TAG, String.format("@%d -> Fragment(currentPage=%d) -> Restored %d posts to fragment", System.identityHashCode(this), displayedPosts.size(), currentPage)); topicPageView.setTopic(topic); topicPageView.setPage(currentPage); topicPageView.setPosts(displayedPosts); restoredPosts = displayedPosts.size() > 0; showPosts(); } } if (displayedPosts == null) { displayedPosts = new ArrayList<>(); } // Implement swipe to refresh swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { savePageScrollPosition(); Log.d(LOG_TAG, String.format("Refreshing topic page '%d' for topic %s", currentPage, topic)); loadPage(currentPage); } }); swipeRefreshLayout.setColorSchemeResources(R.color.theme_primary, R.color.theme_primary_dark); if (errorReloadButton != null) { errorReloadButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(LOG_TAG, String.format("Refreshing topic page '%d' for topic %s", currentPage, topic)); showLoadingIndicator(); loadPage(currentPage); } }); } replyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Joiner joiner = Joiner.on("\n"); startReplyActivity(joiner.join(quotedMessages.values())); } }); topicPageView.setOnScrollListener(new TopicPageView.OnScrollListener() { @Override public void onScrolled(int dx, int dy) { if (dy < 0) { hideReplyButton(); } else { showReplyButton(); } } }); topicPageView.setOnPageLoadedListener(new TopicPageView.OnPageLoadedListener() { @Override public void onPageLoaded() { if (currentScrollPosition > 0) { restorePageScrollPosition(); } } }); topicPageView.setOnMultiQuoteModeListener(new TopicPageView.OnMultiQuoteModeListener() { @Override public void onMultiQuoteModeToggled(boolean active) { if (active) { quotedMessages.clear(); } Fragment parent = getParentFragment(); if (parent != null) { // Multi-quote event is forwarded to parent fragment as a batch operation ((TopicFragment) parent).onBatchOperation(active); } } @Override public void onPostAdded(final long postId) { subscribe(quoteHandler.load(postId, mdService.getQuote(userManager.getActiveUser(), topic, (int) postId), new EndlessObserver<String>() { @Override public void onNext(String quoteBBCode) { quotedMessages.put(postId, quoteBBCode); } @Override public void onError(Throwable throwable) { Log.e(LOG_TAG, "Failed to add post to quoted list", throwable); Toast.makeText(getActivity(), R.string.post_failed_to_quote, Toast.LENGTH_SHORT) .show(); } })); } @Override public void onPostRemoved(long postId) { quotedMessages.remove(postId); } @Override public void onQuote() { Joiner joiner = Joiner.on("\n"); topicPageView.disableBatchActions(); startReplyActivity(joiner.join(quotedMessages.values())); } }); if (userManager.getActiveUser().isGuest()) { replyButton.setVisibility(View.INVISIBLE); } return rootView; }
From source file:org.envirocar.app.application.service.BackgroundServiceImpl.java
@Override public void onDestroy() { logger.info("onDestroy " + getClass().getName() + "; Hash: " + System.identityHashCode(this)); stopBackgroundService();// w w w. ja v a 2 s . c om stopForeground(true); }