/** For a given file, find the associated secondary entry. * @param fo file object * @return the entry associated with the file object, or <code>null</code> if there is no * such entry */ public final Entry findSecondaryEntry (FileObject fo) { Entry e; synchronized ( synchObjectSecondary() ) { e = (Entry)getSecondary().get (fo); } return e; }
private boolean existReadOnlySecondary() { synchronized ( synchObjectSecondary() ) { Iterator it = getSecondary().keySet().iterator(); while (it.hasNext()) if ( ((FileObject)it.next()).isReadOnly() ) return true; } return false; }
/** Get secondary entries. * @return immutable set of {@link Entry}s */ public final Set secondaryEntries () { synchronized ( synchObjectSecondary() ) { removeAllInvalid (); return new HashSet (getSecondary().values ()); } }
protected void handleDelete() throws IOException { ArrayList toRemove = new ArrayList(); Iterator it; synchronized ( synchObjectSecondary() ) { it = new ArrayList(getSecondary().entrySet ()).iterator(); } while (it.hasNext ()) { Map.Entry e = (Map.Entry)it.next (); ((Entry)e.getValue ()).delete (); toRemove.add(e.getKey()); } synchronized ( synchObjectSecondary() ) { Object[] objects = toRemove.toArray(); for (int i = 0; i < objects.length; i++) getSecondary().remove(objects[i]); } getPrimaryEntry().delete(); }
/** Save pairs Entry <-> Entry.getFile () in the list * @return list of saved pairs */ final List saveEntries() { synchronized ( synchObjectSecondary() ) { LinkedList ll = new LinkedList(); Iterator it = secondaryEntries ().iterator (); ll.add (new Pair(getPrimaryEntry ())); while (it.hasNext ()) { MultiDataObject.Entry en = (MultiDataObject.Entry)it.next (); ll.add (new Pair(en)); } return ll; } }
/** Does the work which was originaly done in MDO.files() method. */ private void doLazyWork() { synchronized (this) { if (!lazyWorkDone) { lazyWorkDone = true; synchronized ( mymdo.synchObjectSecondary() ) { mymdo.removeAllInvalid (); primaryFile = mymdo.getPrimaryFile(); secondary = mymdo.getSecondary(); } } } }
synchronized ( synchObjectSecondary() ) { it = new ArrayList(getSecondary().entrySet ()).iterator(); synchronized ( synchObjectSecondary() ) {
synchronized ( synchObjectSecondary() ) { it = new ArrayList(getSecondary().entrySet ()).iterator(); synchronized ( synchObjectSecondary() ) {