Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.ws.api.ha;
28 import com.sun.xml.internal.ws.api.message.Packet;
30 /**
31 * This class has HA information
32 * <p>
33 *
34 * This would help a loadbalancer to put the request(in case of a fail-over)
35 * on a replica instance that has all the related data. Even if there is no
36 * loadbalancer, a backing store could locate the information by directly
37 * going to the correct replica instance. This would also help any part of
38 * the runtime to know about failover case(and in-turn may invalidate
39 * local caches).
40 *
41 * <p>
42 * To achieve this functionality, it carries two pieces of information:
43 * <ol>
44 * <li>key - Related {@link com.sun.org.glassfish.ha.store.api.BackingStore} keys can
45 * use this info for their HashableKey impl. First store creates this object,
46 * and subsequent related stores use the same key.
47 * <li>replicaInstance - where the related info is replicated
48 * </ol>
49 *
50 * <p>
51 * This can be accessed from {@link Packet} using {@link Packet#HA_INFO}
52 * property by the runtime. This object is created typically
53 * <ul>
54 * <li> When a store happens for the first time
55 * <li> A subsequent inbound transport creates from cookies
56 * <li> A fail-over request stores the data to a different replica
57 * </ul>
58 *
59 * @author Jitendra Kotamraju
60 * @since JAX-WS RI 2.2.2
61 */
62 public class HaInfo {
63 private final String replicaInstance;
64 private final String key;
65 private final boolean failOver;
67 public HaInfo(String key, String replicaInstance, boolean failOver) {
68 this.key = key;
69 this.replicaInstance = replicaInstance;
70 this.failOver = failOver;
71 }
73 public String getReplicaInstance() {
74 return replicaInstance;
75 }
77 public String getKey() {
78 return key;
79 }
81 public boolean isFailOver() {
82 return failOver;
83 }
84 }