code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public OTMConnection acquireConnection(PBKey pbKey)
{
TransactionFactory txFactory = getTransactionFactory();
return txFactory.acquireConnection(pbKey);
} | java |
public void sendMessageToAgents(String[] agent_name, String msgtype,
Object message_content, Connector connector) {
HashMap<String, Object> hm = new HashMap<String, Object>();
hm.put("performative", msgtype);
hm.put(SFipa.CONTENT, message_content);
IComponentIdentifier[] ici ... | java |
public void sendMessageToAgentsWithExtraProperties(String[] agent_name,
String msgtype, Object message_content,
ArrayList<Object> properties, Connector connector) {
HashMap<String, Object> hm = new HashMap<String, Object>();
hm.put("performative", msgtype);
hm.put(SFipa.C... | java |
public void lock(Object obj, int lockMode) throws LockNotGrantedException
{
if (log.isDebugEnabled()) log.debug("lock object was called on tx " + this + ", object is " + obj.toString());
checkOpen();
RuntimeObject rtObject = new RuntimeObject(obj, this);
lockAndRegister(rtObject... | java |
protected synchronized void doWriteObjects(boolean isFlush) throws TransactionAbortedException, LockNotGrantedException
{
/*
arminw:
if broker isn't in PB-tx, start tx
*/
if (!getBroker().isInTransaction())
{
if (log.isDebugEnabled()) log.debug("ca... | java |
protected synchronized void doClose()
{
try
{
LockManager lm = getImplementation().getLockManager();
Enumeration en = objectEnvelopeTable.elements();
while (en.hasMoreElements())
{
ObjectEnvelope oe = (ObjectEnvelope) en.nextEle... | java |
protected void refresh()
{
if (log.isDebugEnabled())
log.debug("Refresh this transaction for reuse: " + this);
try
{
// we reuse ObjectEnvelopeTable instance
objectEnvelopeTable.refresh();
}
catch (Exception e)
{
... | java |
public void abort()
{
/*
do nothing if already rolledback
*/
if (txStatus == Status.STATUS_NO_TRANSACTION
|| txStatus == Status.STATUS_UNKNOWN
|| txStatus == Status.STATUS_ROLLEDBACK)
{
log.info("Nothing to abort, tx is not... | java |
public Object getObjectByIdentity(Identity id)
throws PersistenceBrokerException
{
checkOpen();
ObjectEnvelope envelope = objectEnvelopeTable.getByIdentity(id);
if (envelope != null)
{
return (envelope.needsDelete() ? null : envelope.getObject());
... | java |
private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
{
if (implicitLocking)
{
Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
while (i.hasNext())
... | java |
public void afterMaterialization(IndirectionHandler handler, Object materializedObject)
{
try
{
Identity oid = handler.getIdentity();
if (log.isDebugEnabled())
log.debug("deferred registration: " + oid);
if(!isOpen())
{
... | java |
public void afterLoading(CollectionProxyDefaultImpl colProxy)
{
if (log.isDebugEnabled()) log.debug("loading a proxied collection a collection: " + colProxy);
Collection data = colProxy.getData();
for (Iterator iterator = data.iterator(); iterator.hasNext();)
{
Obje... | java |
protected boolean isTransient(ClassDescriptor cld, Object obj, Identity oid)
{
// if the Identity is transient we assume a non-persistent object
boolean isNew = oid != null && oid.isTransient();
/*
detection of new objects is costly (select of ID in DB to check if object
... | java |
private License getLicense(final String licenseId) {
License result = null;
final Set<DbLicense> matchingLicenses = licenseMatcher.getMatchingLicenses(licenseId);
if (matchingLicenses.isEmpty()) {
result = DataModelFactory.createLicense("#" + licenseId + "# (to be identified)", NOT_... | java |
private String[] getHeaders() {
final List<String> headers = new ArrayList<>();
if(decorator.getShowSources()){
headers.add(SOURCE_FIELD);
}
if(decorator.getShowSourcesVersion()){
headers.add(SOURCE_VERSION_FIELD);
}
if(decorator.getShowTargets(... | java |
public InputStream getStream(String url, RasterLayer layer) throws IOException {
if (layer instanceof ProxyLayerSupport) {
ProxyLayerSupport proxyLayer = (ProxyLayerSupport) layer;
if (proxyLayer.isUseCache() && null != cacheManagerService) {
Object cachedObject = cacheManagerService.get(proxyLayer, CacheCa... | java |
private Envelope getLayerEnvelope(ProxyLayerSupport layer) {
Bbox bounds = layer.getLayerInfo().getMaxExtent();
return new Envelope(bounds.getX(), bounds.getMaxX(), bounds.getY(), bounds.getMaxY());
} | java |
private static String buildErrorMsg(List<String> dependencies, String message) {
final StringBuilder buffer = new StringBuilder();
boolean isFirstElement = true;
for (String dependency : dependencies) {
if (!isFirstElement) {
buffer.append(", ");
}
... | java |
protected Query buildPrefetchQuery(Collection ids)
{
CollectionDescriptor cds = getCollectionDescriptor();
QueryByCriteria query = buildPrefetchQuery(ids, cds.getForeignKeyFieldDescriptors(getItemClassDescriptor()));
// check if collection must be ordered
if (!cds.getOrderBy()... | java |
protected void associateBatched(Collection owners, Collection children)
{
CollectionDescriptor cds = getCollectionDescriptor();
PersistentField field = cds.getPersistentField();
PersistenceBroker pb = getBroker();
Class ownerTopLevelClass = pb.getTopLevelClass(getOwnerClassDescr... | java |
protected ManageableCollection createCollection(CollectionDescriptor desc, Class collectionClass)
{
Class fieldType = desc.getPersistentField().getType();
ManageableCollection col;
if (collectionClass == null)
{
if (ManageableCollection.class.isAssi... | java |
@Api
public void setFeatureModel(FeatureModel featureModel) throws LayerException {
this.featureModel = featureModel;
if (null != getLayerInfo()) {
featureModel.setLayerInfo(getLayerInfo());
}
filterService.registerFeatureModel(featureModel);
} | java |
public void update(Object feature) throws LayerException {
Session session = getSessionFactory().getCurrentSession();
session.update(feature);
} | java |
private void enforceSrid(Object feature) throws LayerException {
Geometry geom = getFeatureModel().getGeometry(feature);
if (null != geom) {
geom.setSRID(srid);
getFeatureModel().setGeometry(feature, geom);
}
} | java |
private Envelope getBoundsLocal(Filter filter) throws LayerException {
try {
Session session = getSessionFactory().getCurrentSession();
Criteria criteria = session.createCriteria(getFeatureInfo().getDataSourceName());
CriteriaVisitor visitor = new CriteriaVisitor((HibernateFeatureModel) getFeatureModel(), da... | java |
public Object getBean(String name) {
Bean bean = beans.get(name);
if (null == bean) {
return null;
}
return bean.object;
} | java |
public void setBean(String name, Object object) {
Bean bean = beans.get(name);
if (null == bean) {
bean = new Bean();
beans.put(name, bean);
}
bean.object = object;
} | java |
public Object remove(String name) {
Bean bean = beans.get(name);
if (null != bean) {
beans.remove(name);
bean.destructionCallback.run();
return bean.object;
}
return null;
} | java |
public void registerDestructionCallback(String name, Runnable callback) {
Bean bean = beans.get(name);
if (null == bean) {
bean = new Bean();
beans.put(name, bean);
}
bean.destructionCallback = callback;
} | java |
public void clear() {
for (Bean bean : beans.values()) {
if (null != bean.destructionCallback) {
bean.destructionCallback.run();
}
}
beans.clear();
} | java |
private String parseLayerId(HttpServletRequest request) {
StringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), "/");
String token = "";
while (tokenizer.hasMoreTokens()) {
token = tokenizer.nextToken();
}
return token;
} | java |
private WmsLayer getLayer(String layerId) {
RasterLayer layer = configurationService.getRasterLayer(layerId);
if (layer instanceof WmsLayer) {
return (WmsLayer) layer;
}
return null;
} | java |
private byte[] createErrorImage(int width, int height, Exception e) throws IOException {
String error = e.getMessage();
if (null == error) {
Writer result = new StringWriter();
PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
error = result.toString();
}
BufferedIm... | java |
public static String formatConnectionEstablishmentMessage(final String connectionName, final String host, final String connectionReason) {
return CON_ESTABLISHMENT_FORMAT.format(new Object[] { connectionName, host, connectionReason });
} | java |
public static String formatConnectionTerminationMessage(final String connectionName, final String host, final String connectionReason, final String terminationReason) {
return CON_TERMINATION_FORMAT.format(new Object[] { connectionName, host, connectionReason, terminationReason });
} | java |
public String findPlatformFor(String jdbcSubProtocol, String jdbcDriver)
{
String platform = (String)jdbcSubProtocolToPlatform.get(jdbcSubProtocol);
if (platform == null)
{
platform = (String)jdbcDriverToPlatform.get(jdbcDriver);
}
return platform;
} | java |
public static void validate(final License license) {
// A license should have a name
if(license.getName() == null ||
license.getName().isEmpty()){
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
.entity("License name should n... | java |
public static void validate(final Module module) {
if (null == module) {
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
.entity("Module cannot be null!")
.build());
}
if(module.getName() == null ||
module... | java |
public static void validate(final Organization organization) {
if(organization.getName() == null ||
organization.getName().isEmpty()){
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
.entity("Organization name cannot be null or empty... | java |
public static void validate(final ArtifactQuery artifactQuery) {
final Pattern invalidChars = Pattern.compile("[^A-Fa-f0-9]");
if(artifactQuery.getUser() == null ||
artifactQuery.getUser().isEmpty()){
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
... | java |
protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException
{
long result;
// lookup sequence name
String sequenceName = calculateSequenceName(field);
try
{
result = buildNextSequence(field.getClassDescriptor(), sequenceName);
... | java |
protected Collection provideStateManagers(Collection pojos)
{
PersistenceCapable pc;
int [] fieldNums;
Iterator iter = pojos.iterator();
Collection result = new ArrayList();
while (iter.hasNext())
{
// obtain a StateManager
pc = (PersistenceCapable) iter.nex... | java |
public final Object copy(final Object toCopy, PersistenceBroker broker)
{
return clone(toCopy, IdentityMapFactory.getIdentityMap(), new HashMap());
} | java |
private static void setFields(final Object from, final Object to,
final Field[] fields, final boolean accessible,
final Map objMap, final Map metadataMap)
{
for (int f = 0, fieldsLength = fields.length; f < fieldsLength; ++f)
{
final Field fiel... | java |
public void registerComponent(java.awt.Component c)
{
unregisterComponent(c);
if (recognizerAbstractClass == null)
{
hmDragGestureRecognizers.put(c,
dragSource.createDefaultDragGestureRecognizer(c,
dragWorker.getAcceptableActions(c), ... | java |
public void unregisterComponent(java.awt.Component c)
{
java.awt.dnd.DragGestureRecognizer recognizer =
(java.awt.dnd.DragGestureRecognizer)this.hmDragGestureRecognizers.remove(c);
if (recognizer != null)
recognizer.setComponent(null);
} | java |
protected Object doInvoke(Object proxy, Method methodToBeInvoked, Object[] args)
throws Throwable
{
Method m =
getRealSubject().getClass().getMethod(
methodToBeInvoked.getName(),
methodToBeInvoked.getParameterTypes());
return m.invoke(getRealSubject(), args);
} | java |
public void addIterator(OJBIterator iterator)
{
/**
* only add iterators that are not null and non-empty.
*/
if (iterator != null)
{
if (iterator.hasNext())
{
setNextIterator();
m_rsIterators.add(iterator);
... | java |
public boolean absolute(int row) throws PersistenceBrokerException
{
// 1. handle the special cases first.
if (row == 0)
{
return true;
}
if (row == 1)
{
m_activeIteratorIndex = 0;
m_activeIterator = (OJBIterator) m_rsIt... | java |
public void releaseDbResources()
{
Iterator it = m_rsIterators.iterator();
while (it.hasNext())
{
((OJBIterator) it.next()).releaseDbResources();
}
} | java |
private boolean setNextIterator()
{
boolean retval = false;
// first, check if the activeIterator is null, and set it.
if (m_activeIterator == null)
{
if (m_rsIterators.size() > 0)
{
m_activeIteratorIndex = 0;
m_current... | java |
public boolean containsIteratorForTable(String aTable)
{
boolean result = false;
if (m_rsIterators != null)
{
for (int i = 0; i < m_rsIterators.size(); i++)
{
OJBIterator it = (OJBIterator) m_rsIterators.get(i);
if (it instanc... | java |
public Class getSearchClass()
{
Object obj = getExampleObject();
if (obj instanceof Identity)
{
return ((Identity) obj).getObjectsTopLevelClass();
}
else
{
return obj.getClass();
}
} | java |
private <T> T getBeanOrNull(String name, Class<T> requiredType) {
if (name == null || !applicationContext.containsBean(name)) {
return null;
} else {
try {
return applicationContext.getBean(name, requiredType);
} catch (BeansException be) {
log.error("Error during getBeanOrNull, not rethrown, " + b... | java |
public void restoreSecurityContext(CacheContext context) {
SavedAuthorization cached = context.get(CacheContext.SECURITY_CONTEXT_KEY, SavedAuthorization.class);
if (cached != null) {
log.debug("Restoring security context {}", cached);
securityManager.restoreSecurityContext(cached);
} else {
securityManag... | java |
private void sortFileList() {
if (this.size() > 1) {
Collections.sort(this.fileList, new Comparator() {
public final int compare(final Object o1, final Object o2) {
final File f1 = (File) o1;
final File f2 = (File) o2;
final Object[] f1TimeAndCount = backupSuffixHelper
... | java |
private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj)
{
ClassDescriptor result;
if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))
{
result = aCld;
}
else
{
result = aCld.getRepository().getDe... | java |
public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy, boolean convertToSql) throws PersistenceBrokerException
{
IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objectOrProxy);
if(handler != null)
{
return getKeyValues(cld, handler.g... | java |
public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException
{
return getKeyValues(cld, oid, true);
} | java |
public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid, boolean convertToSql) throws PersistenceBrokerException
{
FieldDescriptor[] pkFields = cld.getPkFields();
ValueContainer[] result = new ValueContainer[pkFields.length];
Object[] pkValues = oid.getPrimaryKeyValues();
... | java |
public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy) throws PersistenceBrokerException
{
return getKeyValues(cld, objectOrProxy, true);
} | java |
public boolean hasNullPKField(ClassDescriptor cld, Object obj)
{
FieldDescriptor[] fields = cld.getPkFields();
boolean hasNull = false;
// an unmaterialized proxy object can never have nullified PK's
IndirectionHandler handler = ProxyHelper.getIndirectionHandler(obj);
i... | java |
public ValueContainer[] getValuesForObject(FieldDescriptor[] fields, Object obj, boolean convertToSql, boolean assignAutoincrement) throws PersistenceBrokerException
{
ValueContainer[] result = new ValueContainer[fields.length];
for(int i = 0; i < fields.length; i++)
{
Fie... | java |
public boolean assertValidPkForDelete(ClassDescriptor cld, Object obj)
{
if(!ProxyHelper.isProxy(obj))
{
FieldDescriptor fieldDescriptors[] = cld.getPkFields();
int fieldDescriptorSize = fieldDescriptors.length;
for(int i = 0; i < fieldDescriptorSize; i++)
... | java |
public Query getCountQuery(Query aQuery)
{
if(aQuery instanceof QueryBySQL)
{
return getQueryBySqlCount((QueryBySQL) aQuery);
}
else if(aQuery instanceof ReportQueryByCriteria)
{
return getReportQueryByCriteriaCount((ReportQueryByCriteria) aQue... | java |
private Query getQueryBySqlCount(QueryBySQL aQuery)
{
String countSql = aQuery.getSql();
int fromPos = countSql.toUpperCase().indexOf(" FROM ");
if(fromPos >= 0)
{
countSql = "select count(*)" + countSql.substring(fromPos);
}
int orderPos = cou... | java |
private Query getQueryByCriteriaCount(QueryByCriteria aQuery)
{
Class searchClass = aQuery.getSearchClass();
ReportQueryByCriteria countQuery = null;
Criteria countCrit = null;
String[] columns = new String[1];
// BRJ: ... | java |
private Query getReportQueryByCriteriaCount(ReportQueryByCriteria aQuery)
{
ReportQueryByCriteria countQuery = (ReportQueryByCriteria) getQueryByCriteriaCount(aQuery);
// BRJ: keep the original columns to build the Join
countQuery.setJoinAttributes(aQuery.getAttributes());
/... | java |
public boolean unlink(Object source, String attributeName, Object target)
{
return linkOrUnlink(false, source, attributeName, false);
} | java |
public void unlink(Object obj, ObjectReferenceDescriptor ord, boolean insert)
{
linkOrUnlink(false, obj, ord, insert);
} | java |
protected boolean _load ()
{
java.sql.ResultSet rs = null;
try
{
// This synchronization is necessary for Oracle JDBC drivers 8.1.7, 9.0.1, 9.2.0.1
// The documentation says synchronization is done within the driver, but they
// must h... | java |
public void removeDescriptor(Object validKey)
{
PBKey pbKey;
if (validKey instanceof PBKey)
{
pbKey = (PBKey) validKey;
}
else if (validKey instanceof JdbcConnectionDescriptor)
{
pbKey = ((JdbcConnectionDescriptor) validKey).getPBKey()... | java |
private int findIndexForName(String[] fieldNames, String searchName)
{
for(int i = 0; i < fieldNames.length; i++)
{
if(searchName.equals(fieldNames[i]))
{
return i;
}
}
throw new PersistenceBrokerException("Can't find field... | java |
private boolean isOrdered(FieldDescriptor[] flds, String[] pkFieldNames)
{
if((flds.length > 1 && pkFieldNames == null) || flds.length != pkFieldNames.length)
{
throw new PersistenceBrokerException("pkFieldName length does not match number of defined PK fields." +
... | java |
private PersistenceBrokerException createException(final Exception ex, String message, final Object objectToIdentify, Class topLevelClass, Class realClass, Object[] pks)
{
final String eol = SystemUtils.LINE_SEPARATOR;
StringBuffer msg = new StringBuffer();
if(message == null)
{... | java |
private void addEdgesForVertex(Vertex vertex)
{
ClassDescriptor cld = vertex.getEnvelope().getClassDescriptor();
Iterator rdsIter = cld.getObjectReferenceDescriptors(true).iterator();
while (rdsIter.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescri... | java |
private void addObjectReferenceEdges(Vertex vertex, ObjectReferenceDescriptor rds)
{
Object refObject = rds.getPersistentField().get(vertex.getEnvelope().getRealObject());
Class refClass = rds.getItemClass();
for (int i = 0; i < vertices.length; i++)
{
Edge edge = n... | java |
private static boolean containsObject(Object searchFor, Object[] searchIn)
{
for (int i = 0; i < searchIn.length; i++)
{
if (searchFor == searchIn[i])
{
return true;
}
}
return false;
} | java |
protected static Map<String, String> getHeadersAsMap(ResponseEntity response) {
Map<String, List<String>> headers = new HashMap<>(response.getHeaders());
Map<String, String> map = new HashMap<>();
for ( Map.Entry<String, List<String>> header :headers.entrySet() ) {
String headerVal... | java |
private void init()
{
jdbcProperties = new Properties();
dbcpProperties = new Properties();
setFetchSize(0);
this.setTestOnBorrow(true);
this.setTestOnReturn(false);
this.setTestWhileIdle(false);
this.setLogAbandoned(false);
this.setRemoveAban... | java |
public void addAttribute(String attributeName, String attributeValue)
{
if (attributeName != null && attributeName.startsWith(JDBC_PROPERTY_NAME_PREFIX))
{
final String jdbcPropertyName = attributeName.substring(JDBC_PROPERTY_NAME_LENGTH);
jdbcProperties.setProperty(jdbc... | java |
private void userInfoInit() {
boolean first = true;
userId = null;
userLocale = null;
userName = null;
userOrganization = null;
userDivision = null;
if (null != authentications) {
for (Authentication auth : authentications) {
userId = combine(userId, auth.getUserId());
userName = combine(userNa... | java |
@Api
public void restoreSecurityContext(SavedAuthorization savedAuthorization) {
List<Authentication> auths = new ArrayList<Authentication>();
if (null != savedAuthorization) {
for (SavedAuthentication sa : savedAuthorization.getAuthentications()) {
Authentication auth = new Authentication();
auth.setSe... | java |
public void work(RepositoryHandler repoHandler, DbProduct product) {
if (!product.getDeliveries().isEmpty()) {
product.getDeliveries().forEach(delivery -> {
final Set<Artifact> artifacts = new HashSet<>();
final DataFetchingUtils utils = new DataFetchingUtils();
... | java |
private ClassDescriptor[] getMultiJoinedClassDescriptors(ClassDescriptor cld)
{
DescriptorRepository repository = cld.getRepository();
Class[] multiJoinedClasses = repository.getSubClassesMultipleJoinedTables(cld, true);
ClassDescriptor[] result = new ClassDescriptor[multiJoinedClasses.l... | java |
private void appendClazzColumnForSelect(StringBuffer buf)
{
ClassDescriptor cld = getSearchClassDescriptor();
ClassDescriptor[] clds = getMultiJoinedClassDescriptors(cld);
if (clds.length == 0)
{
return;
}
buf.append(",CASE");
... | java |
Object lookup(String key) throws ObjectNameNotFoundException
{
Object result = null;
NamedEntry entry = localLookup(key);
// can't find local bound object
if(entry == null)
{
try
{
PersistenceBroker broker = tx.getBroker();
... | java |
void unbind(String key)
{
NamedEntry entry = new NamedEntry(key, null, false);
localUnbind(key);
addForDeletion(entry);
} | java |
public DescriptorRepository readDescriptorRepository(String fileName)
{
try
{
RepositoryPersistor persistor = new RepositoryPersistor();
return persistor.readDescriptorRepository(fileName);
}
catch (Exception e)
{
throw new Metadat... | java |
public DescriptorRepository readDescriptorRepository(InputStream inst)
{
try
{
RepositoryPersistor persistor = new RepositoryPersistor();
return persistor.readDescriptorRepository(inst);
}
catch (Exception e)
{
throw new MetadataEx... | java |
public ConnectionRepository readConnectionRepository(String fileName)
{
try
{
RepositoryPersistor persistor = new RepositoryPersistor();
return persistor.readConnectionRepository(fileName);
}
catch (Exception e)
{
throw new Metadat... | java |
public ConnectionRepository readConnectionRepository(InputStream inst)
{
try
{
RepositoryPersistor persistor = new RepositoryPersistor();
return persistor.readConnectionRepository(inst);
}
catch (Exception e)
{
throw new MetadataEx... | java |
public void addProfile(Object key, DescriptorRepository repository)
{
if (metadataProfiles.contains(key))
{
throw new MetadataException("Duplicate profile key. Key '" + key + "' already exists.");
}
metadataProfiles.put(key, repository);
} | java |
public void loadProfile(Object key)
{
if (!isEnablePerThreadChanges())
{
throw new MetadataException("Can not load profile with disabled per thread mode");
}
DescriptorRepository rep = (DescriptorRepository) metadataProfiles.get(key);
if (rep == null)
... | java |
private PBKey buildDefaultKey()
{
List descriptors = connectionRepository().getAllDescriptor();
JdbcConnectionDescriptor descriptor;
PBKey result = null;
for (Iterator iterator = descriptors.iterator(); iterator.hasNext();)
{
descriptor = (JdbcConnectionDes... | java |
private Object toReference(int type, Object referent, int hash)
{
switch (type)
{
case HARD:
return referent;
case SOFT:
return new SoftRef(hash, referent, queue);
case WEAK:
return new WeakRef(hash, referen... | java |
private Entry getEntry(Object key)
{
if (key == null) return null;
int hash = hashCode(key);
int index = indexFor(hash);
for (Entry entry = table[index]; entry != null; entry = entry.next)
{
if ((entry.hash == hash) && equals(key, entry.getKey()))
... | java |
private int indexFor(int hash)
{
// mix the bits to avoid bucket collisions...
hash += ~(hash << 15);
hash ^= (hash >>> 10);
hash += (hash << 3);
hash ^= (hash >>> 6);
hash += ~(hash << 11);
hash ^= (hash >>> 16);
return hash & (table.length -... | java |
public Object get(Object key)
{
purge();
Entry entry = getEntry(key);
if (entry == null) return null;
return entry.getValue();
} | java |
public Object remove(Object key)
{
if (key == null) return null;
purge();
int hash = hashCode(key);
int index = indexFor(hash);
Entry previous = null;
Entry entry = table[index];
while (entry != null)
{
if ((hash == entry.hash) &&... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.