File tree Expand file tree Collapse file tree
java/server/src/org/openqa/selenium/grid Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Licensed to the Software Freedom Conservancy (SFC) under one
2+ // or more contributor license agreements. See the NOTICE file
3+ // distributed with this work for additional information
4+ // regarding copyright ownership. The SFC licenses this file
5+ // to you under the Apache License, Version 2.0 (the
6+ // "License"); you may not use this file except in compliance
7+ // with the License. You may obtain a copy of the License at
8+ //
9+ // http://www.apache.org/licenses/LICENSE-2.0
10+ //
11+ // Unless required by applicable law or agreed to in writing,
12+ // software distributed under the License is distributed on an
13+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ // KIND, either express or implied. See the License for the
15+ // specific language governing permissions and limitations
16+ // under the License.
17+
18+ package org .openqa .selenium .grid .data ;
19+
20+ import org .openqa .selenium .events .Event ;
21+ import org .openqa .selenium .events .Type ;
22+
23+ public class NodeDrainStarted extends Event {
24+
25+ public static final Type NODE_DRAIN_STARTED = new Type ("node-drain-started" );
26+
27+ public NodeDrainStarted (NodeId id ) {
28+ super (NODE_DRAIN_STARTED , id );
29+ }
30+
31+ }
Original file line number Diff line number Diff line change 3232import org .openqa .selenium .grid .data .CreateSessionRequest ;
3333import org .openqa .selenium .grid .data .CreateSessionResponse ;
3434import org .openqa .selenium .grid .data .NodeDrainComplete ;
35+ import org .openqa .selenium .grid .data .NodeDrainStarted ;
3536import org .openqa .selenium .grid .data .NodeId ;
3637import org .openqa .selenium .grid .data .NodeStatus ;
3738import org .openqa .selenium .grid .data .Session ;
@@ -324,8 +325,6 @@ public boolean isSupporting(Capabilities capabilities) {
324325
325326 @ Override
326327 public NodeStatus getStatus () {
327-
328-
329328 return new NodeStatus (
330329 getId (),
331330 getUri (),
@@ -344,6 +343,7 @@ public NodeStatus getStatus() {
344343
345344 @ Override
346345 public void drain () {
346+ events .fire (new NodeDrainStarted (getId ()));
347347 draining = true ;
348348 }
349349
Original file line number Diff line number Diff line change 3535import org .openqa .selenium .grid .data .CreateSessionRequest ;
3636import org .openqa .selenium .grid .data .CreateSessionResponse ;
3737import org .openqa .selenium .grid .data .NodeDrainComplete ;
38+ import org .openqa .selenium .grid .data .NodeDrainStarted ;
3839import org .openqa .selenium .grid .data .NodeId ;
3940import org .openqa .selenium .grid .data .NodeStatus ;
4041import org .openqa .selenium .grid .data .Session ;
@@ -447,11 +448,12 @@ public HealthCheck getHealthCheck() {
447448
448449 @ Override
449450 public void drain () {
451+ bus .fire (new NodeDrainStarted (getId ()));
450452 draining = true ;
451453 int currentSessionCount = getCurrentSessionCount ();
452454 if (currentSessionCount == 0 ) {
453455 LOG .info ("Firing node drain complete message" );
454- bus .fire (new NodeDrainComplete (this . getId ()));
456+ bus .fire (new NodeDrainComplete (getId ()));
455457 } else {
456458 pendingSessions .set (currentSessionCount );
457459 }
You can’t perform that action at this time.
0 commit comments