Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/RunState.java

Issue 1246033002: Roll cacheinvalidation to 20150720 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with 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 6 * You may obtain a copy of the License at
7 * 7 *
8 * http://www.apache.org/licenses/LICENSE-2.0 8 * http://www.apache.org/licenses/LICENSE-2.0
9 * 9 *
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, 11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 package com.google.ipc.invalidation.ticl; 17 package com.google.ipc.invalidation.ticl;
18 18
19 import com.google.ipc.invalidation.ticl.proto.Client.RunStateP; 19 import com.google.ipc.invalidation.ticl.proto.Client.RunStateP;
20 import com.google.ipc.invalidation.util.Marshallable; 20 import com.google.ipc.invalidation.util.Marshallable;
21 21
22 /** 22 /**
23 * An abstraction that keeps track of whether the caller is started or stopped a nd only allows 23 * An abstraction that keeps track of whether the caller is started or stopped a nd only allows
24 * the following transitions NOT_STARTED -> STARTED -> STOPPED. This class is th read-safe. 24 * the following transitions NOT_STARTED -> STARTED -> STOPPED. This class is th read-safe.
25 * 25 *
26 */ 26 */
27 public class RunState implements Marshallable<RunStateP> { 27 public class RunState implements Marshallable<RunStateP> {
28 /** Current run state ({@link RunStateP}). */ 28 /** Current run state ({@link RunStateP}). */
29 private Integer currentState; 29 private Integer currentState;
30 private Object lock = new Object(); 30 private final Object lock = new Object();
31 31
32 /** Constructs a new instance in the {@code NOT_STARTED} state. */ 32 /** Constructs a new instance in the {@code NOT_STARTED} state. */
33 public RunState() { 33 public RunState() {
34 currentState = RunStateP.State.NOT_STARTED; 34 currentState = RunStateP.State.NOT_STARTED;
35 } 35 }
36 36
37 /** Constructs a new instance with the state given in {@code runState}. */ 37 /** Constructs a new instance with the state given in {@code runState}. */
38 RunState(RunStateP runState) { 38 RunState(RunStateP runState) {
39 this.currentState = runState.getState(); 39 this.currentState = runState.getState();
40 } 40 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 @Override 86 @Override
87 public RunStateP marshal() { 87 public RunStateP marshal() {
88 return RunStateP.create(currentState); 88 return RunStateP.create(currentState);
89 } 89 }
90 90
91 @Override 91 @Override
92 public String toString() { 92 public String toString() {
93 return "<RunState: " + currentState + ">"; 93 return "<RunState: " + currentState + ">";
94 } 94 }
95 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698