| 1 |
/* |
| 2 |
* |
| 3 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 4 |
* or more contributor license agreements. See the NOTICE file |
| 5 |
* distributed with this work for additional information |
| 6 |
* regarding copyright ownership. The ASF licenses this file |
| 7 |
* to you under the Apache License, Version 2.0 (the |
| 8 |
* "License"); you may not use this file except in compliance |
| 9 |
* with the License. You may obtain a copy of the License at |
| 10 |
* |
| 11 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
* |
| 13 |
* Unless required by applicable law or agreed to in writing, |
| 14 |
* software distributed under the License is distributed on an |
| 15 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 |
* KIND, either express or implied. See the License for the |
| 17 |
* specific language governing permissions and limitations |
| 18 |
* under the License. |
| 19 |
* |
| 20 |
*/ |
| 21 |
package org.apache.qpid.proton.engine.impl; |
| 22 |
|
| 23 |
import java.util.ArrayList; |
| 24 |
import java.util.EnumSet; |
| 25 |
import java.util.Iterator; |
| 26 |
import java.util.List; |
| 27 |
import java.util.Map; |
| 28 |
|
| 29 |
import org.apache.qpid.proton.amqp.Symbol; |
| 30 |
import org.apache.qpid.proton.amqp.transport.Open; |
| 31 |
import org.apache.qpid.proton.engine.Collector; |
| 32 |
import org.apache.qpid.proton.engine.EndpointState; |
| 33 |
import org.apache.qpid.proton.engine.Event; |
| 34 |
import org.apache.qpid.proton.engine.Link; |
| 35 |
import org.apache.qpid.proton.engine.ProtonJConnection; |
| 36 |
import org.apache.qpid.proton.engine.Session; |
| 37 |
import org.apache.qpid.proton.reactor.Reactor; |
| 38 |
|
| 39 |
public class ConnectionImpl extends EndpointImpl implements ProtonJConnection |
| 40 |
{ |
| 41 |
public static final int MAX_CHANNELS = 65535; |
| 42 |
|
| 43 |
private List<SessionImpl> _sessions = new ArrayList<SessionImpl>(); |
| 44 |
private EndpointImpl _transportTail; |
| 45 |
private EndpointImpl _transportHead; |
| 46 |
private int _maxChannels = MAX_CHANNELS; |
| 47 |
|
| 48 |
private LinkNode<SessionImpl> _sessionHead; |
| 49 |
private LinkNode<SessionImpl> _sessionTail; |
| 50 |
|
| 51 |
|
| 52 |
private LinkNode<LinkImpl> _linkHead; |
| 53 |
private LinkNode<LinkImpl> _linkTail; |
| 54 |
|
| 55 |
|
| 56 |
private DeliveryImpl _workHead; |
| 57 |
private DeliveryImpl _workTail; |
| 58 |
|
| 59 |
private TransportImpl _transport; |
| 60 |
private DeliveryImpl _transportWorkHead; |
| 61 |
private DeliveryImpl _transportWorkTail; |
| 62 |
private int _transportWorkSize = 0; |
| 63 |
private String _localContainerId = ""; |
| 64 |
private String _localHostname; |
| 65 |
private String _remoteContainer; |
| 66 |
private String _remoteHostname; |
| 67 |
private Symbol[] _offeredCapabilities; |
| 68 |
private Symbol[] _desiredCapabilities; |
| 69 |
private Symbol[] _remoteOfferedCapabilities; |
| 70 |
private Symbol[] _remoteDesiredCapabilities; |
| 71 |
private Map<Symbol, Object> _properties; |
| 72 |
private Map<Symbol, Object> _remoteProperties; |
| 73 |
|
| 74 |
private Object _context; |
| 75 |
private CollectorImpl _collector; |
| 76 |
private Reactor _reactor; |
| 77 |
|
| 78 |
private static final Symbol[] EMPTY_SYMBOL_ARRAY = new Symbol[0]; |
| 79 |
|
| 80 |
/** |
| 81 |
* Application code should use {@link org.apache.qpid.proton.engine.Connection.Factory#create()} instead. |
| 82 |
*/ |
| 83 |
public ConnectionImpl() |
| 84 |
{ |
| 85 |
} |
| 86 |
|
| 87 |
@Override |
| 88 |
public SessionImpl session() |
| 89 |
{ |
| 90 |
SessionImpl session = new SessionImpl(this); |
| 91 |
_sessions.add(session); |
| 92 |
|
| 93 |
|
| 94 |
return session; |
| 95 |
} |
| 96 |
|
| 97 |
void freeSession(SessionImpl session) |
| 98 |
{ |
| 99 |
_sessions.remove(session); |
| 100 |
} |
| 101 |
|
| 102 |
protected LinkNode<SessionImpl> addSessionEndpoint(SessionImpl endpoint) |
| 103 |
{ |
| 104 |
LinkNode<SessionImpl> node; |
| 105 |
if(_sessionHead == null) |
| 106 |
{ |
| 107 |
node = _sessionHead = _sessionTail = LinkNode.newList(endpoint); |
| 108 |
} |
| 109 |
else |
| 110 |
{ |
| 111 |
node = _sessionTail = _sessionTail.addAtTail(endpoint); |
| 112 |
} |
| 113 |
return node; |
| 114 |
} |
| 115 |
|
| 116 |
void removeSessionEndpoint(LinkNode<SessionImpl> node) |
| 117 |
{ |
| 118 |
LinkNode<SessionImpl> prev = node.getPrev(); |
| 119 |
LinkNode<SessionImpl> next = node.getNext(); |
| 120 |
|
| 121 |
if(_sessionHead == node) |
| 122 |
{ |
| 123 |
_sessionHead = next; |
| 124 |
} |
| 125 |
if(_sessionTail == node) |
| 126 |
{ |
| 127 |
_sessionTail = prev; |
| 128 |
} |
| 129 |
node.remove(); |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
protected LinkNode<LinkImpl> addLinkEndpoint(LinkImpl endpoint) |
| 134 |
{ |
| 135 |
LinkNode<LinkImpl> node; |
| 136 |
if(_linkHead == null) |
| 137 |
{ |
| 138 |
node = _linkHead = _linkTail = LinkNode.newList(endpoint); |
| 139 |
} |
| 140 |
else |
| 141 |
{ |
| 142 |
node = _linkTail = _linkTail.addAtTail(endpoint); |
| 143 |
} |
| 144 |
return node; |
| 145 |
} |
| 146 |
|
| 147 |
|
| 148 |
void removeLinkEndpoint(LinkNode<LinkImpl> node) |
| 149 |
{ |
| 150 |
LinkNode<LinkImpl> prev = node.getPrev(); |
| 151 |
LinkNode<LinkImpl> next = node.getNext(); |
| 152 |
|
| 153 |
if(_linkHead == node) |
| 154 |
{ |
| 155 |
_linkHead = next; |
| 156 |
} |
| 157 |
if(_linkTail == node) |
| 158 |
{ |
| 159 |
_linkTail = prev; |
| 160 |
} |
| 161 |
node.remove(); |
| 162 |
} |
| 163 |
|
| 164 |
|
| 165 |
@Override |
| 166 |
public Session sessionHead(final EnumSet<EndpointState> local, final EnumSet<EndpointState> remote) |
| 167 |
{ |
| 168 |
if(_sessionHead == null) |
| 169 |
{ |
| 170 |
return null; |
| 171 |
} |
| 172 |
else |
| 173 |
{ |
| 174 |
LinkNode.Query<SessionImpl> query = new EndpointImplQuery<SessionImpl>(local, remote); |
| 175 |
LinkNode<SessionImpl> node = query.matches(_sessionHead) ? _sessionHead : _sessionHead.next(query); |
| 176 |
return node == null ? null : node.getValue(); |
| 177 |
} |
| 178 |
} |
| 179 |
|
| 180 |
@Override |
| 181 |
public Link linkHead(EnumSet<EndpointState> local, EnumSet<EndpointState> remote) |
| 182 |
{ |
| 183 |
if(_linkHead == null) |
| 184 |
{ |
| 185 |
return null; |
| 186 |
} |
| 187 |
else |
| 188 |
{ |
| 189 |
LinkNode.Query<LinkImpl> query = new EndpointImplQuery<LinkImpl>(local, remote); |
| 190 |
LinkNode<LinkImpl> node = query.matches(_linkHead) ? _linkHead : _linkHead.next(query); |
| 191 |
return node == null ? null : node.getValue(); |
| 192 |
} |
| 193 |
} |
| 194 |
|
| 195 |
@Override |
| 196 |
protected ConnectionImpl getConnectionImpl() |
| 197 |
{ |
| 198 |
return this; |
| 199 |
} |
| 200 |
|
| 201 |
@Override |
| 202 |
void postFinal() { |
| 203 |
put(Event.Type.CONNECTION_FINAL, this); |
| 204 |
} |
| 205 |
|
| 206 |
@Override |
| 207 |
void doFree() { |
| 208 |
List<SessionImpl> sessions = new ArrayList<SessionImpl>(_sessions); |
| 209 |
for(Session session : sessions) { |
| 210 |
session.free(); |
| 211 |
} |
| 212 |
_sessions = null; |
| 213 |
} |
| 214 |
|
| 215 |
void modifyEndpoints() { |
| 216 |
if (_sessions != null) { |
| 217 |
for (SessionImpl ssn: _sessions) { |
| 218 |
ssn.modifyEndpoints(); |
| 219 |
} |
| 220 |
} |
| 221 |
if (!freed) { |
| 222 |
modified(); |
| 223 |
} |
| 224 |
} |
| 225 |
|
| 226 |
void handleOpen(Open open) |
| 227 |
{ |
| 228 |
// TODO - store state |
| 229 |
setRemoteState(EndpointState.ACTIVE); |
| 230 |
setRemoteHostname(open.getHostname()); |
| 231 |
setRemoteContainer(open.getContainerId()); |
| 232 |
setRemoteDesiredCapabilities(open.getDesiredCapabilities()); |
| 233 |
setRemoteOfferedCapabilities(open.getOfferedCapabilities()); |
| 234 |
setRemoteProperties(open.getProperties()); |
| 235 |
put(Event.Type.CONNECTION_REMOTE_OPEN, this); |
| 236 |
} |
| 237 |
|
| 238 |
|
| 239 |
EndpointImpl getTransportHead() |
| 240 |
{ |
| 241 |
return _transportHead; |
| 242 |
} |
| 243 |
|
| 244 |
EndpointImpl getTransportTail() |
| 245 |
{ |
| 246 |
return _transportTail; |
| 247 |
} |
| 248 |
|
| 249 |
void addModified(EndpointImpl endpoint) |
| 250 |
{ |
| 251 |
if(_transportTail == null) |
| 252 |
{ |
| 253 |
endpoint.setTransportNext(null); |
| 254 |
endpoint.setTransportPrev(null); |
| 255 |
_transportHead = _transportTail = endpoint; |
| 256 |
} |
| 257 |
else |
| 258 |
{ |
| 259 |
_transportTail.setTransportNext(endpoint); |
| 260 |
endpoint.setTransportPrev(_transportTail); |
| 261 |
_transportTail = endpoint; |
| 262 |
_transportTail.setTransportNext(null); |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
void removeModified(EndpointImpl endpoint) |
| 267 |
{ |
| 268 |
if(_transportHead == endpoint) |
| 269 |
{ |
| 270 |
_transportHead = endpoint.transportNext(); |
| 271 |
} |
| 272 |
else |
| 273 |
{ |
| 274 |
endpoint.transportPrev().setTransportNext(endpoint.transportNext()); |
| 275 |
} |
| 276 |
|
| 277 |
if(_transportTail == endpoint) |
| 278 |
{ |
| 279 |
_transportTail = endpoint.transportPrev(); |
| 280 |
} |
| 281 |
else |
| 282 |
{ |
| 283 |
endpoint.transportNext().setTransportPrev(endpoint.transportPrev()); |
| 284 |
} |
| 285 |
} |
| 286 |
|
| 287 |
@Override |
| 288 |
public int getMaxChannels() |
| 289 |
{ |
| 290 |
return _maxChannels; |
| 291 |
} |
| 292 |
|
| 293 |
public String getLocalContainerId() |
| 294 |
{ |
| 295 |
return _localContainerId; |
| 296 |
} |
| 297 |
|
| 298 |
@Override |
| 299 |
public void setLocalContainerId(String localContainerId) |
| 300 |
{ |
| 301 |
_localContainerId = localContainerId; |
| 302 |
} |
| 303 |
|
| 304 |
@Override |
| 305 |
public DeliveryImpl getWorkHead() |
| 306 |
{ |
| 307 |
return _workHead; |
| 308 |
} |
| 309 |
|
| 310 |
@Override |
| 311 |
public void setContainer(String container) |
| 312 |
{ |
| 313 |
_localContainerId = container; |
| 314 |
} |
| 315 |
|
| 316 |
@Override |
| 317 |
public String getContainer() |
| 318 |
{ |
| 319 |
return _localContainerId; |
| 320 |
} |
| 321 |
|
| 322 |
@Override |
| 323 |
public void setHostname(String hostname) |
| 324 |
{ |
| 325 |
_localHostname = hostname; |
| 326 |
} |
| 327 |
|
| 328 |
@Override |
| 329 |
public String getRemoteContainer() |
| 330 |
{ |
| 331 |
return _remoteContainer; |
| 332 |
} |
| 333 |
|
| 334 |
@Override |
| 335 |
public String getRemoteHostname() |
| 336 |
{ |
| 337 |
return _remoteHostname; |
| 338 |
} |
| 339 |
|
| 340 |
@Override |
| 341 |
public void setOfferedCapabilities(Symbol[] capabilities) |
| 342 |
{ |
| 343 |
_offeredCapabilities = capabilities; |
| 344 |
} |
| 345 |
|
| 346 |
@Override |
| 347 |
public void setDesiredCapabilities(Symbol[] capabilities) |
| 348 |
{ |
| 349 |
_desiredCapabilities = capabilities; |
| 350 |
} |
| 351 |
|
| 352 |
@Override |
| 353 |
public Symbol[] getRemoteOfferedCapabilities() |
| 354 |
{ |
| 355 |
return _remoteOfferedCapabilities == null ? EMPTY_SYMBOL_ARRAY : _remoteOfferedCapabilities; |
| 356 |
} |
| 357 |
|
| 358 |
@Override |
| 359 |
public Symbol[] getRemoteDesiredCapabilities() |
| 360 |
{ |
| 361 |
return _remoteDesiredCapabilities == null ? EMPTY_SYMBOL_ARRAY : _remoteDesiredCapabilities; |
| 362 |
} |
| 363 |
|
| 364 |
|
| 365 |
Symbol[] getOfferedCapabilities() |
| 366 |
{ |
| 367 |
return _offeredCapabilities; |
| 368 |
} |
| 369 |
|
| 370 |
Symbol[] getDesiredCapabilities() |
| 371 |
{ |
| 372 |
return _desiredCapabilities; |
| 373 |
} |
| 374 |
|
| 375 |
void setRemoteOfferedCapabilities(Symbol[] remoteOfferedCapabilities) |
| 376 |
{ |
| 377 |
_remoteOfferedCapabilities = remoteOfferedCapabilities; |
| 378 |
} |
| 379 |
|
| 380 |
void setRemoteDesiredCapabilities(Symbol[] remoteDesiredCapabilities) |
| 381 |
{ |
| 382 |
_remoteDesiredCapabilities = remoteDesiredCapabilities; |
| 383 |
} |
| 384 |
|
| 385 |
|
| 386 |
Map<Symbol, Object> getProperties() |
| 387 |
{ |
| 388 |
return _properties; |
| 389 |
} |
| 390 |
|
| 391 |
@Override |
| 392 |
public void setProperties(Map<Symbol, Object> properties) |
| 393 |
{ |
| 394 |
_properties = properties; |
| 395 |
} |
| 396 |
|
| 397 |
@Override |
| 398 |
public Map<Symbol, Object> getRemoteProperties() |
| 399 |
{ |
| 400 |
return _remoteProperties; |
| 401 |
} |
| 402 |
|
| 403 |
void setRemoteProperties(Map<Symbol, Object> remoteProperties) |
| 404 |
{ |
| 405 |
_remoteProperties = remoteProperties; |
| 406 |
} |
| 407 |
|
| 408 |
@Override |
| 409 |
public String getHostname() |
| 410 |
{ |
| 411 |
return _localHostname; |
| 412 |
} |
| 413 |
|
| 414 |
void setRemoteContainer(String remoteContainerId) |
| 415 |
{ |
| 416 |
_remoteContainer = remoteContainerId; |
| 417 |
} |
| 418 |
|
| 419 |
void setRemoteHostname(String remoteHostname) |
| 420 |
{ |
| 421 |
_remoteHostname = remoteHostname; |
| 422 |
} |
| 423 |
|
| 424 |
DeliveryImpl getWorkTail() |
| 425 |
{ |
| 426 |
return _workTail; |
| 427 |
} |
| 428 |
|
| 429 |
void removeWork(DeliveryImpl delivery) |
| 430 |
{ |
| 431 |
if (!delivery._work) return; |
| 432 |
|
| 433 |
DeliveryImpl next = delivery.getWorkNext(); |
| 434 |
DeliveryImpl prev = delivery.getWorkPrev(); |
| 435 |
|
| 436 |
if (prev != null) { |
| 437 |
prev.setWorkNext(next); |
| 438 |
} |
| 439 |
|
| 440 |
if (next != null) { |
| 441 |
next.setWorkPrev(prev); |
| 442 |
} |
| 443 |
|
| 444 |
delivery.setWorkNext(null); |
| 445 |
delivery.setWorkPrev(null); |
| 446 |
|
| 447 |
if(_workHead == delivery) |
| 448 |
{ |
| 449 |
_workHead = next; |
| 450 |
|
| 451 |
} |
| 452 |
|
| 453 |
if(_workTail == delivery) |
| 454 |
{ |
| 455 |
_workTail = prev; |
| 456 |
} |
| 457 |
|
| 458 |
delivery._work = false; |
| 459 |
} |
| 460 |
|
| 461 |
void addWork(DeliveryImpl delivery) |
| 462 |
{ |
| 463 |
if (delivery._work) return; |
| 464 |
|
| 465 |
delivery.setWorkNext(null); |
| 466 |
delivery.setWorkPrev(_workTail); |
| 467 |
|
| 468 |
if (_workTail != null) { |
| 469 |
_workTail.setWorkNext(delivery); |
| 470 |
} |
| 471 |
|
| 472 |
_workTail = delivery; |
| 473 |
|
| 474 |
if (_workHead == null) { |
| 475 |
_workHead = delivery; |
| 476 |
} |
| 477 |
|
| 478 |
delivery._work = true; |
| 479 |
} |
| 480 |
|
| 481 |
public Iterator<DeliveryImpl> getWorkSequence() |
| 482 |
{ |
| 483 |
return new WorkSequence(_workHead); |
| 484 |
} |
| 485 |
|
| 486 |
void setTransport(TransportImpl transport) |
| 487 |
{ |
| 488 |
_transport = transport; |
| 489 |
} |
| 490 |
|
| 491 |
@Override |
| 492 |
public TransportImpl getTransport() |
| 493 |
{ |
| 494 |
return _transport; |
| 495 |
} |
| 496 |
|
| 497 |
private static class WorkSequence implements Iterator<DeliveryImpl> |
| 498 |
{ |
| 499 |
private DeliveryImpl _next; |
| 500 |
|
| 501 |
public WorkSequence(DeliveryImpl workHead) |
| 502 |
{ |
| 503 |
_next = workHead; |
| 504 |
} |
| 505 |
|
| 506 |
@Override |
| 507 |
public boolean hasNext() |
| 508 |
{ |
| 509 |
return _next != null; |
| 510 |
} |
| 511 |
|
| 512 |
@Override |
| 513 |
public void remove() |
| 514 |
{ |
| 515 |
throw new UnsupportedOperationException(); |
| 516 |
} |
| 517 |
|
| 518 |
@Override |
| 519 |
public DeliveryImpl next() |
| 520 |
{ |
| 521 |
DeliveryImpl next = _next; |
| 522 |
if(next != null) |
| 523 |
{ |
| 524 |
_next = next.getWorkNext(); |
| 525 |
} |
| 526 |
return next; |
| 527 |
} |
| 528 |
} |
| 529 |
|
| 530 |
DeliveryImpl getTransportWorkHead() |
| 531 |
{ |
| 532 |
return _transportWorkHead; |
| 533 |
} |
| 534 |
|
| 535 |
int getTransportWorkSize() { |
| 536 |
return _transportWorkSize; |
| 537 |
} |
| 538 |
|
| 539 |
public void removeTransportWork(DeliveryImpl delivery) |
| 540 |
{ |
| 541 |
if (!delivery._transportWork) return; |
| 542 |
|
| 543 |
DeliveryImpl next = delivery.getTransportWorkNext(); |
| 544 |
DeliveryImpl prev = delivery.getTransportWorkPrev(); |
| 545 |
|
| 546 |
if (prev != null) { |
| 547 |
prev.setTransportWorkNext(next); |
| 548 |
} |
| 549 |
|
| 550 |
if (next != null) { |
| 551 |
next.setTransportWorkPrev(prev); |
| 552 |
} |
| 553 |
|
| 554 |
delivery.setTransportWorkNext(null); |
| 555 |
delivery.setTransportWorkPrev(null); |
| 556 |
|
| 557 |
if(_transportWorkHead == delivery) |
| 558 |
{ |
| 559 |
_transportWorkHead = next; |
| 560 |
|
| 561 |
} |
| 562 |
|
| 563 |
if(_transportWorkTail == delivery) |
| 564 |
{ |
| 565 |
_transportWorkTail = prev; |
| 566 |
} |
| 567 |
|
| 568 |
delivery._transportWork = false; |
| 569 |
_transportWorkSize--; |
| 570 |
} |
| 571 |
|
| 572 |
void addTransportWork(DeliveryImpl delivery) |
| 573 |
{ |
| 574 |
modified(); |
| 575 |
if (delivery._transportWork) return; |
| 576 |
|
| 577 |
delivery.setTransportWorkNext(null); |
| 578 |
delivery.setTransportWorkPrev(_transportWorkTail); |
| 579 |
|
| 580 |
if (_transportWorkTail != null) { |
| 581 |
_transportWorkTail.setTransportWorkNext(delivery); |
| 582 |
} |
| 583 |
|
| 584 |
_transportWorkTail = delivery; |
| 585 |
|
| 586 |
if (_transportWorkHead == null) { |
| 587 |
_transportWorkHead = delivery; |
| 588 |
} |
| 589 |
|
| 590 |
delivery._transportWork = true; |
| 591 |
_transportWorkSize++; |
| 592 |
} |
| 593 |
|
| 594 |
void workUpdate(DeliveryImpl delivery) |
| 595 |
{ |
| 596 |
if(delivery != null) |
| 597 |
{ |
| 598 |
if(!delivery.isSettled() && |
| 599 |
(delivery.isReadable() || |
| 600 |
delivery.isWritable() || |
| 601 |
delivery.isUpdated())) |
| 602 |
{ |
| 603 |
addWork(delivery); |
| 604 |
} |
| 605 |
else |
| 606 |
{ |
| 607 |
removeWork(delivery); |
| 608 |
} |
| 609 |
} |
| 610 |
} |
| 611 |
|
| 612 |
@Override |
| 613 |
public Object getContext() |
| 614 |
{ |
| 615 |
return _context; |
| 616 |
} |
| 617 |
|
| 618 |
@Override |
| 619 |
public void setContext(Object context) |
| 620 |
{ |
| 621 |
_context = context; |
| 622 |
} |
| 623 |
|
| 624 |
@Override |
| 625 |
public void collect(Collector collector) |
| 626 |
{ |
| 627 |
_collector = (CollectorImpl) collector; |
| 628 |
|
| 629 |
put(Event.Type.CONNECTION_INIT, this); |
| 630 |
|
| 631 |
LinkNode<SessionImpl> ssn = _sessionHead; |
| 632 |
while (ssn != null) { |
| 633 |
put(Event.Type.SESSION_INIT, ssn.getValue()); |
| 634 |
ssn = ssn.getNext(); |
| 635 |
} |
| 636 |
|
| 637 |
LinkNode<LinkImpl> lnk = _linkHead; |
| 638 |
while (lnk != null) { |
| 639 |
put(Event.Type.LINK_INIT, lnk.getValue()); |
| 640 |
lnk = lnk.getNext(); |
| 641 |
} |
| 642 |
} |
| 643 |
|
| 644 |
EventImpl put(Event.Type type, Object context) |
| 645 |
{ |
| 646 |
if (_collector != null) { |
| 647 |
return _collector.put(type, context); |
| 648 |
} else { |
| 649 |
return null; |
| 650 |
} |
| 651 |
} |
| 652 |
|
| 653 |
@Override |
| 654 |
void localOpen() |
| 655 |
{ |
| 656 |
put(Event.Type.CONNECTION_LOCAL_OPEN, this); |
| 657 |
} |
| 658 |
|
| 659 |
@Override |
| 660 |
void localClose() |
| 661 |
{ |
| 662 |
put(Event.Type.CONNECTION_LOCAL_CLOSE, this); |
| 663 |
} |
| 664 |
|
| 665 |
@Override |
| 666 |
public Reactor getReactor() { |
| 667 |
return _reactor; |
| 668 |
} |
| 669 |
|
| 670 |
public void setReactor(Reactor reactor) { |
| 671 |
_reactor = reactor; |
| 672 |
} |
| 673 |
} |