??xml version="1.0" encoding="utf-8" standalone="yes"?>
5.Javascript
]]>
MyEc Javascript 调试器试首个为Javascript。完整集成客LEclipse调试器。特征主要包含:
The head of this queue is the least element with respect to the specified ordering. If multiple elements are tied for least value, the head is one of those elements -- ties are broken arbitrarily. The queue retrieval operations poll, remove, peek, and element access the element at the head of the queue.
q个队列头是最的元素伴随期望限定的排序。如果多个元素ؓ最的值约束,头是q些元素中的一?--U束是Q意打断的。队列获得操作poll(?,remove(U除)Qpeek 和在队列头部的元?/P>
A priority queue is unbounded, but has an internal capacity governing the size of an array used to store the elements on the queue. It is always at least as large as the queue size. As elements are added to a priority queue, its capacity grows automatically. The details of the growth policy are not specified.
一个优先队列是极大的,但是拥有一个内部的定w调节数组的大用来存储在队列中的元素。它L臛_和队列大是是一样大的。作为元素被加入一个优先队列,它的定w是自动增加的。增加策略的l节是没有指定的?/P>
This class and its iterator implement all of the optional methods of the Collection and Iterator interfaces. The Iterator provided in method iterator() is not guaranteed to traverse the elements of the PriorityQueue in any particular order. If you need ordered traversal, consider using Arrays.sort(pq.toArray()).
q个cd它的枚D实现所有可选的集合和枚举接口的Ҏ。这个枚举支持iterator()Ҏ是不保证在Q何特定的序遍历PriorityQueue的元素。如果你需要顺序的遍历Q考虑使用Array.sort(pq.toArray()).
Note that this implementation is not synchronized. Multiple threads should not access a PriorityQueue instance concurrently if any of the threads modifies the list structurally. Instead, use the thread-safe PriorityBlockingQueue class.
注意q个实现不是不同步的。多个线E不应当q发讉K一个PriorityQueue实例Q如果线E在l构上线EQ一个被修改。作为替换,使用U程安全的PriorityBlockingQueuecR?/P>
Implementation note: this implementation provides O(log(n)) time for the insertion methods (offer, poll, remove() and add) methods; linear time for the remove(Object) and contains(Object) methods; and constant time for the retrieval methods (peek, element, and size).
This class is a member of the Java Collections Framework.
Since:
1.5
See Also:
Serialized Form
Utility classes commonly useful in concurrent programming. This package includes a few small standardized extensible frameworks, as well as some classes that provide useful functionality and are otherwise tedious(沉闷? or difficult to implement. Here are brief(摘要? descriptions of the main components. See also the locks(? and atomic(原子? packages.
Executors(执行?
Interfaces. Executor is a simple standardized interface for defining custom thread-like subsystems(子系l?, including thread pools(U程?, asynchronous IO(异步IO), and lightweight task frameworks(轻量UQ务框?. Depending on which concrete Executor class is being used, tasks may execute in a newly(以新的方? created thread, an existing task-execution thread, or the thread calling execute(), and may execute sequentially(l箋? or concurrently(q发?. ExecutorService provides a more complete asynchronous(异步? task execution framework. An ExecutorService manages queuing(队列) and scheduling(行程安排) of tasks, and allows controlled shutdown. The ScheduledExecutorService subinterface adds support for delayed(延时? and periodic(定期? task execution. ExecutorServices provide methods arranging(安排? asynchronous execution of any function expressed as Callable, the result-bearing analog(cM? of Runnable. A Future returns the results of a function, allows determination of whether execution has completed, and provides a means to cancel execution.
Implementations. Classes ThreadPoolExecutor and ScheduledThreadPoolExecutor provide tunable(可调?, flexible(灉|? thread pools. The Executors class provides factory methods for the most common kinds and configurations of Executors, as well as a few utility methods for using them. Other utilities based on Executors include the concrete class FutureTask providing a common extensible implementation of Futures, and ExecutorCompletionService, that assists in coordinating(计算调配中心) the processing of groups of asynchronous(异步? tasks.
[Executor ExecutorService ScheduledExecutorService ScheduledThreadPoolExecutor ExecutionCompletionService]
Queues(队列)
The java.util.concurrent ConcurrentLinkedQueue class supplies an efficient scalable(可升U的) thread-safe(U程安全) non-blocking(非模块化) FIFO queue. Five implementations in java.util.concurrent support the extended BlockingQueue interface, that defines blocking versions of put and take: LinkedBlockingQueue, ArrayBlockingQueue, SynchronousQueue, PriorityBlockingQueue, and DelayQueue. The different classes cover the most common usage contexts for producer-consumer, messaging, parallel tasking, and related concurrent designs.
[LinkedBlockingQueue ArrayBlockingQueue SynchronousQueue PriorityBlockingQueue DelayQueue]
Timing(定时)
The TimeUnit class provides multiple granularities<间隔寸> (including nanoseconds十亿分之一U? for specifying and controlling time-out(暂停) based operations. Most classes in the package contain operations based on time-outs in addition to(?..以外) indefinite(不确定的) waits. In all cases that time-outs are used, the time-out specifies the minimum time that the method should wait before indicating(指出) that it timed-out. Implementations make a "best effort" to detectQ察觉) time-outs as soon as possible after they occur. However, an indefinite(模糊? amount of time may elapse(? between a time-out being detected and a thread actually executing again after that time-out.
Synchronizers(同步)
Four classes aid(帮助) common special-purpose synchronization idioms(语法). Semaphore(旗语) is a classic concurrency tool. CountDownLatch(Countdown 倒数计秒 latch门插销) is a very simple yet very common utility for blocking until a given number of signals, events, or conditions hold. A CyclicBarrier(cyclic 循环?barrier 屏障) is a resettable(可重|的) multiway(多\? synchronization point useful in some styles of parallel programming. An Exchanger allows two threads to exchange(交换) objects at a rendezvous point(集合?, and is useful in several pipeline(道) designs.
Concurrent Collections(q发集合)
Besides Queues, this package supplies a few Collection implementations designed for use in multithreaded contexts: ConcurrentHashMap, CopyOnWriteArrayList, and CopyOnWriteArraySet.
The "Concurrent" prefix used with some classes in this package is a shorthand(速记) indicating several differences from similar "synchronized" classes. For example java.util.Hashtable and Collections.synchronizedMap(new HashMap()) are synchronized. But ConcurrentHashMap is "concurrent". A concurrent collection is thread-safe, but not governed by a single exclusion lock. In the particular case of ConcurrentHashMap, it safely permits any number of concurrent reads as well as a tunable number of concurrent writes. "Synchronized" classes can be useful when you need to prevent all access to a collection via a single lock, at the expense of poorer scalability. In other cases in which multiple threads are expected to access a common collection, "concurrent" versions are normally preferable. And unsynchronized collections are preferable when either collections are unshared, or are accessible only when holding other locks.
Most concurrent Collection implementations (including most Queues) also differ from the usual java.util conventions in that their Iterators provide weakly consistent rather than fast-fail traversal. A weakly consistent iterator is thread-safe, but does not necessarily freeze the collection while iterating, so it may (or may not) reflect any updates since the iterator was created.
Since:
1.5
public String[] split(String regex)
This method works as if by invoking the two-argument split
method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.
The string "boo:and:foo", for example, yields the following results with these expressions:
Regex Result : { "boo", "and", "foo" } o { "b", "", ":and:f" }
regex
- the delimiting regular expression
PatternSyntaxException
- if the regular expression's syntax is invalid
Pattern
public interface LoginModule
LoginModule
describes the interface implemented by authentication technology providers. LoginModules are plugged in under applications to provide a particular type of authentication.
While applications write to the LoginContext
API, authentication technology providers implement the LoginModule
interface. A Configuration
specifies the LoginModule(s) to be used with a particular login application. Therefore different LoginModules can be plugged in under the application without requiring any modifications to the application itself.
The LoginContext
is responsible<负责> for reading the Configuration
and instantiating the appropriate<适当?gt; LoginModules. Each LoginModule
is initialized with a Subject
, a CallbackHandler
, shared LoginModule
state, and LoginModule-specific options. The Subject
represents the Subject
currently being authenticated and is updated with relevant<相关> Credentials<凭证> if authentication succeeds. LoginModules use the CallbackHandler
to communicate with users. The CallbackHandler
may be used to prompt for usernames and passwords, for example. Note that the CallbackHandler
may be null. LoginModules which absolutely require a CallbackHandler
to authenticate<认证> the Subject
may throw a LoginException
. LoginModules optionally use the shared state to share information or data among themselves.
NameCallback:
PasswordCallback:
The LoginModule-specific options represent the options configured for this LoginModule
by an administrator or user in the login Configuration
. The options are defined by the LoginModule
itself and control the behavior within it. For example, a LoginModule
may define options to support debugging/testing capabilities<能力>. Options are defined using a key-value syntax, such as debug=true. The LoginModule
stores the options as a Map
so that the values may be retrieved using the key. Note that there is no limit to the number of options a LoginModule
chooses to define.
The calling application sees the authentication process as a single operation. However, the authentication process within the LoginModule
proceeds in two distinct phases. In the first phase, the LoginModule's login
method gets invoked by the LoginContext's login
method. The login
method for the LoginModule
then performs the actual authentication (prompt for and verify a password for example) and saves its authentication status as private state information. Once finished, the LoginModule's login
method either returns true
(if it succeeded) or false
(if it should be ignored), or throws a LoginException
to specify a failure. In the failure case, the LoginModule
must not retry the authentication or introduce delays. The responsibility of such tasks belongs to the application. If the application attempts to retry the authentication, the LoginModule's login
method will be called again.
In the second phase, if the LoginContext's overall<全面> authentication succeeded (the relevant REQUIRED, REQUISITE<需?gt;, SUFFICIENT<_> and OPTIONAL LoginModules succeeded), then the commit
method for the LoginModule
gets invoked. The commit
method for a LoginModule
checks its privately saved state to see if its own authentication succeeded. If the overall LoginContext
authentication succeeded and the LoginModule's own authentication succeeded, then the commit
method associates the relevant<相关> Principals (authenticated identities) and Credentials<凭证> (authentication data such as cryptographic keys) with the Subject
located within the LoginModule
.
If the LoginContext's overall authentication failed (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules did not succeed), then the abortQ异常)
method for each LoginModule
gets invoked. In this case, the LoginModule
removes/destroys any authentication state originally saved.
Logging out a Subject
involves only one phase. The LoginContext
invokes the LoginModule's logout
method. The logout
method for the LoginModule
then performs the logout procedures, such as removing Principals or Credentials from the Subject
or logging session information.
A LoginModule
implementation must have a constructor with no arguments<无参数构造子>. This allows classes which load the LoginModule
to instantiate it.
原文地址Q?A >http://www.javaresearch.org/article/showarticle.jsp?column=106&thread=18541