PageRenderTime 14ms CodeModel.GetById 7ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/hazelcast/src/main/java/com/hazelcast/core/InstanceDestroyedException.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 55 lines | 30 code | 10 blank | 15 comment | 0 complexity | 5fb8d1ad05406b336a3c44db6b88d3af MD5 | raw file
 1/*
 2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.hazelcast.core;
18
19import com.hazelcast.nio.DataSerializable;
20
21import java.io.DataInput;
22import java.io.DataOutput;
23import java.io.IOException;
24
25public class InstanceDestroyedException extends Exception implements DataSerializable {
26    private Instance.InstanceType type;
27    private String name;
28
29    public InstanceDestroyedException() {
30    }
31
32    public InstanceDestroyedException(Instance.InstanceType type, String name) {
33        this.type = type;
34        this.name = name;
35    }
36
37    public Instance.InstanceType getType() {
38        return type;
39    }
40
41    public String getName() {
42        return name;
43    }
44
45    public void writeData(DataOutput out) throws IOException {
46        out.writeInt(type.getTypeId());
47        out.writeUTF(name);
48    }
49
50    public void readData(DataInput in) throws IOException {
51        int id = in.readInt();
52        type = Instance.InstanceType.valueOf(id);
53        name = in.readUTF();
54    }
55}