public final class NodeUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
NodeUtil.NodeFilter
Deprecated.
replaced by
NodeFilter . |
static class |
NodeUtil.ReloadMode
Tailors the level of user interaction while reloading a
Node . |
Modifier and Type | Field and Description |
---|---|
static int |
RELOAD_PROMPTED
Deprecated.
|
static int |
RELOAD_PROMPTED_IF_DIRTY
Deprecated.
|
static int |
RELOAD_SILENTLY
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static java.util.WeakHashMap<Node,java.lang.Long> |
getTimeStampMap() |
static void |
reloadBuffers(java.util.Collection<Node> nodes, boolean silentReload)
Identical to
reloadBuffers(java.util.Map, boolean) but reloads the node independently of the timestamp. |
static void |
reloadBuffers(java.util.Collection<Node> nodes, java.util.Map<Node,java.lang.Long> timestampMap, int reloadMode, boolean manualReload)
Deprecated.
|
static void |
reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap)
A convenience method for doing a silent reload.
|
static void |
reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap, boolean silentReload)
This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk.
|
static void |
reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap, boolean silentReload, boolean manualReload)
Deprecated.
|
static void |
reloadBuffers(java.util.Map<Node,java.lang.Long> node2timestampMap, java.util.Set<NodeUtil.ReloadMode> reloadFlags)
This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk.
|
static void |
reloadNodes(java.util.Collection<Node> nodesToBeReloaded, java.util.Set<NodeUtil.ReloadMode> reloadFlags)
Reloads all
Node buffers passed in. |
static void |
runUnderReadLock(java.util.Collection<? extends Node> nodes, java.lang.Runnable r)
Executes a Runnable while holding the read lock on the given nodes.
|
static void |
runUnderWriteLock(java.util.Collection<? extends Node> nodes, java.lang.Runnable r)
Executes a Runnable while holding the write lock on the given nodes.
|
static void |
startReloading(boolean silentReload, boolean manualReload, boolean checkTimeStamp) |
static void |
startReloading(java.util.Set<NodeUtil.ReloadMode> reloadFlags, boolean checkTimeStamp) |
static void |
stopReloading() |
static void |
storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap)
Stores the timestamps for all Nodes in the NodeFactory's cache that are currently open.
|
static void |
storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, NodeFilter nodeFilter)
Stores the timestamps for all Nodes in the NodeFactory's cache that are currently open.
|
static void |
storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, java.util.Collection<Node> nodes) |
static void |
storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, java.util.Collection<Node> nodes, NodeFilter nodeFilter) |
@Deprecated public static final int RELOAD_PROMPTED
NodeUtil.ReloadMode.SILENT_RELOAD
.ReloadMode}
, Constant Field Values@Deprecated public static final int RELOAD_PROMPTED_IF_DIRTY
@Deprecated public static final int RELOAD_SILENTLY
public static void runUnderReadLock(java.util.Collection<? extends Node> nodes, java.lang.Runnable r)
The calling thread must not already hold the read or write lock on any of the Node instances, or it must hold the read or write lock on all of the Node instances. In other words, re-entrant locking of the same set of nodes is allowed.
The nodes being locked must all be instances of the same Node subclass. This is to prevent deadlock due to additional ordering constraints between different Node subclasses.
nodes
- the Node instances to lockr
- the Runnable to be run while the locks are heldjava.lang.IllegalArgumentException
- if the Collection contains null, the Runnable is null, or the Node instances are not all instances of the same Node subclassjava.lang.IllegalMonitorStateException
- if the Node instances are in an invalid lock state on the calling threadpublic static void runUnderWriteLock(java.util.Collection<? extends Node> nodes, java.lang.Runnable r)
The calling thread must not already hold the read or write lock on any of the Node instances, or it must hold the write lock on all of the Node instances. In other words, re-entrant locking of the same set of nodes is allowed.
The nodes being locked must all be instances of the same Node subclass. This is to prevent deadlock due to additional ordering constraints between different Node subclasses.
nodes
- the Node instances to lockr
- the Runnable to be run while the locks are heldjava.lang.IllegalArgumentException
- if the Collection contains null, the Runnable is null, or the Node instances are not all instances of the same Node subclassjava.lang.IllegalMonitorStateException
- if the Node instances are in an invalid lock state on the calling threadpublic static void storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap)
timestampMap
- A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL)
for the Node's URL.java.lang.NullPointerException
- if the specified timestampMap is null.public static void storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, NodeFilter nodeFilter)
timestampMap
- A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL)
for the Node's URL.nodeFilter
- A node filter controlling which timestamps are stored. Any nodes which do not pass this filter will be excluded from the resulting timestamp map.java.lang.NullPointerException
- if the specified timestampMap is null.public static void storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, java.util.Collection<Node> nodes)
timestampMap
- A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL)
for the Node's URL.nodes
- A Collection of Node objects whose timestamps will be stored in the timestampMap. Only Nodes whose Node.isOpen()
method returns true will have their timestamp stored in the timestampMap; otherwise, if the Node is not open, its timestamp will be removed from the Map. Any timestamp in the map not corresponding to any Node in the Collection will remain. This allows multiple calls to storeTimestamps with different Collections of Nodes.java.lang.NullPointerException
- if any of the parameters are null.public static void storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, java.util.Collection<Node> nodes, NodeFilter nodeFilter)
timestampMap
- A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL)
for the Node's URL.nodes
- A Collection of Node objects whose timestamps will be stored in the timestampMap. Only Nodes which pass the given node filter will have their timestamp stored in the timestampMap; otherwise, if the Node is not accepted, its timestamp will be removed from the Map. Any timestamp in the map not corresponding to any Node in the Collection will remain. This allows multiple calls to storeTimestamps with different Collections of Nodes.nodeFilter
- A node filter controlling which timestamps are stored. Any nodes which do not pass this filter will be excluded from the resulting timestamp map.java.lang.NullPointerException
- if any of the parameters are null.public static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap)
#reloadBuffers(Map, Set)}
public static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap, boolean silentReload)
timestampMap
- A Map of Node->Long. This must be the same map that was passed to storeTimestamps(java.util.Map<oracle.ide.model.Node, java.lang.Long>, java.util.Collection<oracle.ide.model.Node>)
. This method will reload the buffers of all the Nodes in the timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the timestampMap.silentReload
- Pass true
if reloading should proceed without prompting the user whenever possible. Pass false
if reloading should always prompt the user. Even when true
is passed, the UI would still end up prompting the user if the Node buffer was modified within the IDE and externally at the same time.@Deprecated public static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap, boolean silentReload, boolean manualReload)
reloadBuffers(Map, Set)
.timestampMap
- A Map of Node->Long. This must be the same map that was passed to storeTimestamps(java.util.Map<oracle.ide.model.Node, java.lang.Long>, java.util.Collection<oracle.ide.model.Node>)
. This method will reload the buffers of all the Nodes in the timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the timestampMap.silentReload
- Pass true
if reloading should proceed without prompting the user whenever possible. Pass false
if reloading should always prompt the user. Even when true
is passed, the UI would still end up prompting the user if the Node buffer was modified within the IDE and externally at the same time.manualReload
- Pass true
if reloading is being requested manually (eg, from a menu or explicit user action); false
otherwise.public static void reloadBuffers(java.util.Collection<Node> nodes, boolean silentReload)
reloadBuffers(java.util.Map, boolean)
but reloads the node independently of the timestamp.nodes
- a collection of nodes to reloadsilentReload
- Pass true
if reloading should proceed without prompting the user whenever possible. Pass false
if reloading should always prompt the user. Even when true
is passed, the UI would still end up prompting the user if the Node buffer was modified within the IDE and externally at the same time.reloadBuffers(java.util.Map<oracle.ide.model.Node, java.lang.Long>)
@Deprecated public static void reloadBuffers(java.util.Collection<Node> nodes, java.util.Map<Node,java.lang.Long> timestampMap, int reloadMode, boolean manualReload)
reloadNodes(Collection, Set)
.nodes
- a collection of nodes to reloadtimestampMap
- A Map of Node->Long. This must be the same map that was passed to storeTimestamps(java.util.Map<oracle.ide.model.Node, java.lang.Long>, java.util.Collection<oracle.ide.model.Node>)
. This method will reload the buffers of all the Nodes in the timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the timestampMap.reloadMode
- A value identifying the mode for buffer reloading. This is one of RELOAD_PROMPTED
, RELOAD_PROMPTED_IF_DIRTY
and RELOAD_SILENTLY
.manualReload
- Pass true
if reloading is being requested manually (eg, from a menu or explicit user action); false
otherwise.public static void reloadNodes(java.util.Collection<Node> nodesToBeReloaded, java.util.Set<NodeUtil.ReloadMode> reloadFlags)
Node
buffers passed in. This method executes synchronously, and will block until all Node
s have been reloaded. Method is thread safe in silent mode only. If not called from the event thread, ensure that the only reload flag set is NodeUtil.ReloadMode.SILENT_RELOAD
.nodesToBeReloaded
- a collection of Node
s all of which need to be reloaded.reloadFlags
- a set of NodeUtil.ReloadMode
s that controls user interaction while reloading.java.lang.IllegalArgumentException
- if the method is called off the event thread and NodeUtil.ReloadMode.SILENT_RELOAD
was not the only flag set.java.lang.NullPointerException
- if nodesToBeReloaded
or reloadFlags
are null
.NodeUtil.ReloadMode
public static void reloadBuffers(java.util.Map<Node,java.lang.Long> node2timestampMap, java.util.Set<NodeUtil.ReloadMode> reloadFlags)
Method is thread safe in silent mode only. If not called from the event thread, ensure that the only reload flag set is NodeUtil.ReloadMode.SILENT_RELOAD
.
node2timestampMap
- A Map of Node->Long. This must be the same map that was passed to NodeUtil#storeAllTimestamps()
. This method will reload the buffers of all the Nodes in the node2timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the node2timestampMap.reloadFlags
- a set of NodeUtil.ReloadMode
s that tailors reload behavior.java.lang.IllegalArgumentException
- if the method is called off the event thread while NodeUtil.ReloadMode.SILENT_RELOAD
was not the only flag set.java.lang.NullPointerException
- if nodesToBeReloaded
or reloadFlags
are null
.NodeUtil.ReloadMode
public static void startReloading(boolean silentReload, boolean manualReload, boolean checkTimeStamp)
public static void startReloading(java.util.Set<NodeUtil.ReloadMode> reloadFlags, boolean checkTimeStamp)
public static void stopReloading()
public static java.util.WeakHashMap<Node,java.lang.Long> getTimeStampMap()