Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.osgi.service.coordinator;

Unchecked exception which may be thrown by a Coordinator implementation.

Author(s):
$Id: cb7e25af0ab76e8956d6544c670edadf3e8cdc01 $
 
 public class CoordinationException extends RuntimeException {
 	private static final long	serialVersionUID	= 1L;

Unknown reason for this exception.
 
 	public final static int		UNKNOWN				= 0;

Registering a Participant with a Coordination would have resulted in a deadlock.
 
 	public final static int		DEADLOCK_DETECTED	= 1;

The Coordination has terminated as a failure with Coordination.fail(java.lang.Throwable). When this exception type is used, the java.lang.Throwable.getCause() method must return a non-null value.
 
 	public final static int		FAILED				= 2;

The Coordination has partially ended.
 
 	public final static int		PARTIALLY_ENDED		= 3;

The Coordination has already terminated normally.
 
 	public final static int		ALREADY_ENDED		= 4;

The Coordination was already on a thread's thread local Coordination stack.
 
 	public final static int		ALREADY_PUSHED		= 5;

The current thread was interrupted while waiting to register a Participant with a Coordination.
 
 	public final static int		LOCK_INTERRUPTED	= 6;

The Coordination cannot be ended by the calling thread since the Coordination is on the thread local Coordination stack of another thread.
 
 	public final static int		WRONG_THREAD		= 7;
 
 	private final String		name;
 	private final int			type;
 	private final long			id;

Create a new Coordination Exception with a cause.

Parameters:
message The detail message for this exception.
coordination The Coordination associated with this exception.
cause The cause associated with this exception.
type The type of this exception.
Throws:
java.lang.IllegalArgumentException If the specified type is FAILED and the specified cause is null.
 
 	public CoordinationException(String messageCoordination coordinationint typeThrowable cause) {
 		super(messagecause);
 		this. = type;
 		if (coordination == null) {
 			this. = -1L;
 			this. = "<>";
 		} else {
 			this. = coordination.getId();
 			this. = coordination.getName();
 		}
 		if ((type == ) && (cause == null)) {
 			throw new IllegalArgumentException("A cause must be specified for type FAILED");
 		}
	}

Create a new Coordination Exception.

Parameters:
message The detail message for this exception.
coordination The Coordination associated with this exception.
type The type of this exception.
Throws:
java.lang.IllegalArgumentException If the specified type is FAILED .
	public CoordinationException(String messageCoordination coordinationint type) {
		super(message);
		this. = type;
		if (coordination == null) {
			this. = -1L;
			this. = "<>";
else {
			this. = coordination.getId();
			this. = coordination.getName();
		}
		if (type == ) {
			throw new IllegalArgumentException("A cause must be specified for type FAILED");
		}
	}

Returns the name of the Coordination associated with this exception.

Returns:
The name of the Coordination associated with this exception or "<>" if no Coordination is associated with this exception.
	public String getName() {
		return ;
	}

Returns the type for this exception.

Returns:
The type of this exception.
	public int getType() {
		return ;
	}

Returns the id of the Coordination associated with this exception.

Returns:
The id of the Coordination associated with this exception or -1 if no Coordination is associated with this exception.
	public long getId() {
		return ;
	}
New to GrepCode? Check out our FAQ X