1 11 12 package com.sun.jmx.snmp.daemon ; 13 14 15 import java.io.Serializable ; 18 import java.net.InetAddress ; 19 import java.util.Vector ; 20 import java.util.Date ; 21 22 import com.sun.jmx.snmp.SnmpMessage; 25 import com.sun.jmx.snmp.SnmpVarBind; 26 import com.sun.jmx.snmp.SnmpPduFactory; 27 import com.sun.jmx.snmp.SnmpPduPacket; 28 import com.sun.jmx.snmp.SnmpPduRequest; 29 import com.sun.jmx.snmp.SnmpPduBulk; 30 import com.sun.jmx.snmp.SnmpDefinitions; 31 import com.sun.jmx.snmp.SnmpStatusException; 32 import com.sun.jmx.snmp.SnmpTooBigException; 33 import com.sun.jmx.snmp.SnmpVarBindList; 34 import com.sun.jmx.snmp.SnmpPdu; 35 import com.sun.jmx.snmp.SnmpPduRequestType; 36 37 import com.sun.jmx.trace.Trace; 40 41 42 82 83 public class SnmpInformRequest implements SnmpDefinitions { 84 85 88 91 private static SnmpRequestCounter requestCounter = new SnmpRequestCounter(); 92 93 96 private SnmpVarBindList varBindList = null; 97 98 101 int errorStatus = 0; 102 103 106 int errorIndex = 0; 107 108 SnmpVarBind internalVarBind[] = null; 110 111 String reason = null; 113 114 117 private transient SnmpAdaptorServer adaptor; 118 119 122 private transient SnmpSession informSession; 123 124 127 private SnmpInformHandler callback = null; 128 129 132 SnmpPdu requestPdu; 134 135 138 SnmpPduRequestType responsePdu; 140 141 144 final static private int stBase = 1; 145 146 149 final static public int stInProgress = stBase; 150 151 154 final static public int stWaitingToSend = (stBase << 1) | stInProgress; 155 156 159 final static public int stWaitingForReply = (stBase << 2) | stInProgress; 160 161 164 final static public int stReceivedReply = (stBase << 3) | stInProgress; 165 166 169 final static public int stAborted = (stBase << 4); 170 171 174 final static public int stTimeout = (stBase << 5); 175 176 179 final static public int stInternalError = (stBase << 6); 180 181 184 final static public int stResultsAvailable = (stBase << 7); 185 186 189 final static public int stNeverUsed = (stBase << 8); 190 191 194 private int numTries = 0; 195 196 200 private int timeout = 3 * 1000; 202 204 private int reqState = stNeverUsed; 205 206 private long prevPollTime = 0; private long nextPollTime = 0; 209 private long waitTimeForResponse; 210 private Date debugDate = new Date (); 211 212 215 private int requestId = 0; 216 217 private int port = 0; 218 219 private InetAddress address = null; 220 private String communityString = null; 221 222 String dbgTag = "SnmpInformRequest"; 223 224 227 237 SnmpInformRequest(SnmpSession session, 238 SnmpAdaptorServer adp, 239 InetAddress addr, 240 String cs, 241 int p, 242 SnmpInformHandler requestCB) 243 throws SnmpStatusException { 244 245 informSession = session; 246 adaptor = adp; 247 address = addr; 248 communityString = cs; 249 port = p; 250 callback = requestCB; 251 informSession.addInformRequest(this); setTimeout(adaptor.getTimeout()) ; 253 } 254 255 258 262 final public synchronized int getRequestId () { 263 return requestId; 264 } 265 266 270 synchronized InetAddress getAddress() { 271 return address; 272 } 273 274 278 final public synchronized int getRequestStatus() { 279 return reqState ; 280 } 281 282 286 final public synchronized boolean isAborted() { 287 return ((reqState & stAborted) == stAborted); 288 } 289 290 294 final public synchronized boolean inProgress() { 295 return ((reqState & stInProgress) == stInProgress); 296 } 297 298 302 final public synchronized boolean isResultAvailable() { 303 return (reqState == stResultsAvailable); 304 } 305 306 310 final public synchronized int getErrorStatus() { 311 return errorStatus; 312 } 313 314 319 final public synchronized int getErrorIndex() { 320 return errorIndex; 321 } 322 323 327 final public int getMaxTries() { 328 return adaptor.getMaxTries(); 329 } 330 331 335 final public synchronized int getNumTries() { 336 return numTries ; 337 } 338 339 342 final synchronized void setTimeout(int value) { 343 timeout = value ; 344 } 345 346 351 final public synchronized long getAbsNextPollTime () { 352 return nextPollTime ; 353 } 354 355 360 final public synchronized long getAbsMaxTimeToWait() { 361 if (prevPollTime == 0) { 362 return System.currentTimeMillis() ; } else { 364 return waitTimeForResponse ; 365 } 366 } 367 368 377 public final synchronized SnmpVarBindList getResponseVarBindList() { 378 if (inProgress()) 379 return null; 380 return varBindList; 381 } 382 383 395 final public boolean waitForCompletion(long time) { 396 397 if (! inProgress()) return true; 399 400 if (informSession.thisSessionContext()) { 401 SnmpInformHandler savedCallback = callback; 404 callback = null; 405 informSession.waitForResponse(this, time); 406 callback = savedCallback; 407 } else { 408 synchronized (this) { 411 SnmpInformHandler savedCallback = callback ; 412 try { 413 callback = null ; 414 this.wait(time) ; 415 } catch (InterruptedException e) { 416 } 417 callback = savedCallback ; 418 } 419 } 420 421 return (! inProgress()); } 423 424 427 final public void cancelRequest() { 428 errorStatus = snmpReqAborted; 429 stopRequest(); 430 deleteRequest(); 431 notifyClient(); 432 } 433 434 437 final public synchronized void notifyClient() { 438 this.notifyAll(); 439 } 440 441 447 public void finalize() { 448 callback = null; 449 varBindList = null; 450 internalVarBind = null; 451 adaptor = null; 452 informSession = null; 453 requestPdu = null; 454 responsePdu = null; 455 } 456 457 462 public static String snmpErrorToString(int errcode) { 463 switch (errcode) { 464 case snmpRspNoError : 465 return "noError" ; 466 case snmpRspTooBig : 467 return "tooBig" ; 468 case snmpRspNoSuchName : 469 return "noSuchName" ; 470 case snmpRspBadValue : 471 return "badValue" ; 472 case snmpRspReadOnly : 473 return "readOnly" ; 474 case snmpRspGenErr : 475 return "genErr" ; 476 case snmpRspNoAccess : 477 return "noAccess" ; 478 case snmpRspWrongType : 479 return "wrongType" ; 480 case snmpRspWrongLength : 481 return "wrongLength" ; 482 case snmpRspWrongEncoding : 483 return "wrongEncoding" ; 484 case snmpRspWrongValue : 485 return "wrongValue" ; 486 case snmpRspNoCreation : 487 return "noCreation" ; 488 case snmpRspInconsistentValue : 489 return "inconsistentValue" ; 490 case snmpRspResourceUnavailable : 491 return "resourceUnavailable" ; 492 case snmpRspCommitFailed : 493 return "commitFailed" ; 494 case snmpRspUndoFailed : 495 return "undoFailed" ; 496 case snmpRspAuthorizationError : 497 return "authorizationError" ; 498 case snmpRspNotWritable : 499 return "notWritable" ; 500 case snmpRspInconsistentName : 501 return "inconsistentName" ; 502 case snmpReqTimeout : 503 return "reqTimeout" ; 504 case snmpReqAborted : 505 return "reqAborted" ; 506 case snmpRspDecodingError : 507 return "rspDecodingError" ; 508 case snmpReqEncodingError : 509 return "reqEncodingError" ; 510 case snmpReqPacketOverflow : 511 return "reqPacketOverflow" ; 512 case snmpRspEndOfTable : 513 return "rspEndOfTable" ; 514 case snmpReqRefireAfterVbFix : 515 return "reqRefireAfterVbFix" ; 516 case snmpReqHandleTooBig : 517 return "reqHandleTooBig" ; 518 case snmpReqTooBigImpossible : 519 return "reqTooBigImpossible" ; 520 case snmpReqInternalError : 521 return "reqInternalError" ; 522 case snmpReqSocketIOError : 523 return "reqSocketIOError" ; 524 case snmpReqUnknownError : 525 return "reqUnknownError" ; 526 case snmpWrongSnmpVersion : 527 return "wrongSnmpVersion" ; 528 case snmpUnknownPrincipal: 529 return "snmpUnknownPrincipal"; 530 case snmpAuthNotSupported: 531 return "snmpAuthNotSupported"; 532 case snmpPrivNotSupported: 533 return "snmpPrivNotSupported"; 534 case snmpBadSecurityLevel: 535 return "snmpBadSecurityLevel"; 536 case snmpUsmBadEngineId: 537 return "snmpUsmBadEngineId"; 538 case snmpUsmInvalidTimeliness: 539 return "snmpUsmInvalidTimeliness"; 540 } 541 return "Unknown Error = " + errcode; 542 } 543 544 547 554 synchronized void start(SnmpVarBindList vblst) throws SnmpStatusException { 555 if (inProgress()) 556 throw new SnmpStatusException("Inform request already in progress."); 557 setVarBindList(vblst); 558 initializeAndFire(); 559 } 560 561 private synchronized void initializeAndFire() { 562 requestPdu = null; 563 responsePdu = null; 564 reason = null; 565 startRequest(System.currentTimeMillis()); 566 setErrorStatusAndIndex(0, 0); 567 } 568 569 575 private synchronized void startRequest(long starttime) { 576 nextPollTime = starttime; 577 prevPollTime = 0; 578 schedulePoll(); 579 } 580 581 584 private void schedulePoll() { 585 numTries = 0; 586 initNewRequest(); 587 setRequestStatus(stWaitingToSend); 588 informSession.getSnmpQManager().addRequest(this); 589 } 590 591 596 void action() { 597 if (inProgress() == false) 598 return; 599 while (true) { 600 try { 601 if (numTries == 0) { 602 invokeOnReady(); 603 } else if (numTries < getMaxTries()) { 604 invokeOnRetry(); 605 } else { 606 invokeOnTimeout(); 607 } 608 return ; 609 } catch (OutOfMemoryError omerr) { 610 numTries++; 613 if (isDebugOn()) { 614 debug("action", "Inform request hit out of memory situation..."); 615 } 616 Thread.currentThread().yield(); 617 } 618 } 619 } 620 621 final private void invokeOnReady() { 622 if (requestPdu == null) { 623 requestPdu = constructPduPacket(); 624 } 625 if (requestPdu != null) { 626 if (sendPdu() == false) 627 queueResponse(); 628 } 629 } 630 631 final private void invokeOnRetry() { 632 invokeOnReady(); 633 } 634 635 final private void invokeOnTimeout() { 636 errorStatus = snmpReqTimeout; 637 queueResponse(); 638 } 639 640 final private void queueResponse() { 641 informSession.addResponse(this); 642 } 643 644 647 synchronized SnmpPdu constructPduPacket() { 648 SnmpPduPacket reqpdu = null; 649 Exception excep = null; 650 try { 651 reqpdu = new SnmpPduRequest(); 652 reqpdu.port = port; 653 reqpdu.type = pduInformRequestPdu; 654 reqpdu.version = snmpVersionTwo; 655 reqpdu.community = communityString.getBytes("8859_1"); 656 reqpdu.requestId = getRequestId(); 657 reqpdu.varBindList = internalVarBind; 658 659 if (isTraceOn()) { 660 trace("constructPduPacket", "Packet built"); 661 } 662 663 } catch (Exception e) { 664 excep = e; 665 errorStatus = snmpReqUnknownError; 666 reason = e.getMessage(); 667 } 668 if (excep != null) { 669 if (isDebugOn()) { 670 debug("constructPduPacket", excep); 671 } 672 reqpdu = null; 673 queueResponse(); 674 } 675 return reqpdu; 676 } 677 678 boolean sendPdu() { 679 try { 680 responsePdu = null; 681 682 SnmpPduFactory pduFactory = adaptor.getPduFactory(); 683 SnmpMessage msg = (SnmpMessage)pduFactory.encodeSnmpPdu((SnmpPduPacket)requestPdu, adaptor.getBufferSize().intValue()); 684 685 if (msg == null) { 686 if (isDebugOn()) { 687 debug("sendPdu", "pdu factory returned a null value"); 688 } 689 throw new SnmpStatusException(snmpReqUnknownError); 690 } 693 694 int maxPktSize = adaptor.getBufferSize().intValue(); 695 byte[] encoding = new byte[maxPktSize]; 696 int encodingLength = msg.encodeMessage(encoding); 697 698 if (isTraceOn()) { 699 trace("sendPdu", "Dump : \n" + msg.printMessage()); 700 } 701 702 sendPduPacket(encoding, encodingLength); 703 return true; 704 } catch (SnmpTooBigException ar) { 705 706 if (isDebugOn()) { 707 debug("sendPdu", ar); 708 } 709 710 setErrorStatusAndIndex(snmpReqPacketOverflow, ar.getVarBindCount()); 711 requestPdu = null; 712 reason = ar.getMessage(); 713 if (isDebugOn()) { 714 debug("sendPdu", "Packet Overflow while building inform request"); 715 } 716 } catch (java.io.IOException ioe) { 717 setErrorStatusAndIndex(snmpReqSocketIOError, 0); 718 reason = ioe.getMessage(); 719 } catch (Exception e) { 720 if (isDebugOn()) { 721 debug("sendPdu", e); 722 } 723 setErrorStatusAndIndex(snmpReqUnknownError, 0); 724 reason = e.getMessage(); 725 } 726 return false; 727 } 728 729 736 final void sendPduPacket(byte[] buffer, int length) throws java.io.IOException { 737 738 if (isTraceOn()) { 739 trace("sendPduPacket", "Send to peer. Peer/Port : " + address.getHostName() + "/" + port + 740 ". Length = " + length + "\nDump : \n" + SnmpMessage.dumpHexBuffer(buffer,0, length)); 741 } 742 SnmpSocket theSocket = informSession.getSocket(); 743 synchronized (theSocket) { 744 theSocket.sendPacket(buffer, length, address, port); 745 setRequestSentTime(System.currentTimeMillis()); 746 } 747 } 748 749 752 final void processResponse() { 753 754 if (isTraceOn()) { 755 trace("processResponse", "errstatus = " + errorStatus); 756 } 757 758 if (inProgress() == false) { responsePdu = null; 760 return; } 762 763 if (errorStatus >= snmpReqInternalError) { 764 handleInternalError("Internal Error..."); 765 return; 766 } 767 768 try { 769 parsePduPacket(responsePdu); 770 772 switch (errorStatus) { 774 case snmpRspNoError : 775 handleSuccess(); 776 return; 777 case snmpReqTimeout : 778 handleTimeout(); 779 return; 780 case snmpReqInternalError : 781 handleInternalError("Unknown internal error. deal with it later!"); 782 return; 783 case snmpReqHandleTooBig : 784 setErrorStatusAndIndex(snmpRspTooBig, 0); 785 handleError("Cannot handle too-big situation..."); 786 return; 787 case snmpReqRefireAfterVbFix : 788 initializeAndFire(); 790 return; 791 default : 792 handleError("Error status set in packet...!!"); 793 return; 794 } 795 } catch (Exception e) { 796 if (isDebugOn()) { 797 debug("processResponse", e); 798 } 799 reason = e.getMessage(); 800 } 801 handleInternalError(reason); 802 } 803 804 808 synchronized void parsePduPacket(SnmpPduRequestType rpdu) { 809 810 if (rpdu == null) 811 return; 812 813 errorStatus = rpdu.getErrorStatus(); 814 errorIndex = rpdu.getErrorIndex(); 815 816 if (errorStatus == snmpRspNoError) { 817 updateInternalVarBindWithResult(((SnmpPdu)rpdu).varBindList); 818 return; 819 } 820 821 if (errorStatus != snmpRspNoError) 822 --errorIndex; 824 if (isTraceOn()) { 825 trace("parsePduPacket", "received inform response. ErrorStatus/ErrorIndex = " + errorStatus + "/" + errorIndex); 826 } 827 } 828 829 832 private void handleSuccess() { 833 834 setRequestStatus(stResultsAvailable); 835 836 if (isTraceOn()) { 837 trace("handleSuccess", "Invoking user defined callback..."); 838 } 839 840 deleteRequest(); notifyClient(); 842 843 requestPdu = null; 844 internalVarBind = null; 846 847 try { if (callback != null) 849 callback.processSnmpPollData(this, errorStatus, errorIndex, getVarBindList()); 850 } catch (Exception e) { 851 if (isDebugOn()) { 852 debug("handleSuccess", "Exception generated by user callback"); 853 debug("handleSuccess", e); 854 } 855 } catch (OutOfMemoryError ome) { 856 if (isDebugOn()) { 857 debug("handleSuccess", "OutOfMemory Error generated by user callback"); 858 debug("handleSuccess", ome); 859 } 860 Thread.currentThread().yield(); 861 } 862 return; 863 } 864 865 868 private void handleTimeout() { 869 870 setRequestStatus(stTimeout); 871 872 if (isDebugOn()) { 873 debug("handleTimeout", "Snmp error/index = " + snmpErrorToString(errorStatus) + "/" + 874 errorIndex + ". Invoking timeout user defined callback..."); 875 } 876 deleteRequest(); 877 notifyClient(); 878 879 requestPdu = null; 880 responsePdu = null; 881 internalVarBind = null; 882 883 try { 884 if (callback != null) 885 callback.processSnmpPollTimeout(this); 886 } catch (Exception e) { if (isDebugOn()) { 888 debug("handleTimeout", "Exception generated by user callback"); 889 debug("handleTimeout", e); 890 } 891 } catch (OutOfMemoryError ome) { 892 if (isDebugOn()) { 893 debug("handleTimeout", "OutOfMemory Error generated by user callback"); 894 debug("handleTimeout", ome); 895 } 896 Thread.currentThread().yield(); 897 } 898 return; 899 } 900 901 904 private void handleError(String msg) { 905 906 setRequestStatus(stResultsAvailable); 907 908 if (isDebugOn()) { 909 debug("handleError", "Snmp error/index = " + snmpErrorToString(errorStatus) + "/" + 910 errorIndex + ". Invoking error user defined callback...\n" + getVarBindList()); 911 } 912 deleteRequest(); 913 notifyClient(); 914 915 requestPdu = null; 916 responsePdu = null; 917 internalVarBind = null; 918 919 try { 920 if (callback != null) 921 callback.processSnmpPollData(this, getErrorStatus(), getErrorIndex(), getVarBindList()); 922 } catch (Exception e) { if (isDebugOn()) { 924 debug("handleError", "Exception generated by user callback"); 925 debug("handleError", e); 926 } 927 } catch (OutOfMemoryError ome) { 928 if (isDebugOn()) { 929 debug("handleError", "OutOfMemory Error generated by user callback"); 930 debug("handleError", ome); 931 } 932 Thread.currentThread().yield(); 933 } 934 } 935 936 939 private void handleInternalError(String msg) { 940 941 setRequestStatus(stInternalError); 942 if (reason == null) 943 reason = msg; 944 945 if (isDebugOn()) { 946 debug("handleInternalError", "Snmp error/index = " + snmpErrorToString(errorStatus) + "/" + 947 errorIndex + ". Invoking internal error user defined callback...\n" + getVarBindList()); 948 } 949 950 deleteRequest(); 951 notifyClient(); 952 953 requestPdu = null; 954 responsePdu = null; 955 internalVarBind = null; 956 957 try { 958 if (callback != null) 959 callback.processSnmpInternalError(this, reason); 960 } catch (Exception e) { if (isDebugOn()) { 962 debug("handleInternalError", "Exception generated by user callback"); 963 debug("handleInternalError", e); 964 } 965 } catch (OutOfMemoryError ome) { 966 if (isDebugOn()) { 967 debug("handleInternalError", "OutOfMemory Error generated by user callback"); 968 debug("handleInternalError", ome); 969 } 970 Thread.currentThread().yield(); 971 } 972 } 973 974 void updateInternalVarBindWithResult(SnmpVarBind[] list) { 975 976 if ((list == null) || (list.length == 0)) 977 return; 978 979 int idx = 0; 980 981 for(int i = 0; i < internalVarBind.length && idx < list.length; i++) { 982 SnmpVarBind avar = internalVarBind[i]; 983 if (avar == null) 984 continue; 985 986 SnmpVarBind res = list[idx]; 987 avar.setSnmpValue(res.getSnmpValue()); 988 idx++; 989 } 990 } 991 992 995 final void invokeOnResponse(Object resp) { 996 if (resp != null) { 997 if (resp instanceof SnmpPduRequestType) 998 responsePdu = (SnmpPduRequestType) resp; 999 else 1000 return; 1001 } 1002 setRequestStatus(stReceivedReply); 1003 queueResponse(); 1004 } 1005 1006 1009 private void stopRequest() { 1010 1011 synchronized(this) { 1017 setRequestStatus(stAborted); 1018 } 1019 informSession.getSnmpQManager().removeRequest(this); 1020 synchronized(this) { 1021 requestId = 0; 1022 } 1023 } 1024 1025 final synchronized void deleteRequest() { 1026 informSession.removeInformRequest(this); 1027 } 1028 1029 1035 final synchronized SnmpVarBindList getVarBindList() { 1036 return varBindList; 1037 } 1038 1039 1044 final synchronized void setVarBindList(SnmpVarBindList newvblst) { 1045 varBindList = newvblst; 1046 if (internalVarBind == null || internalVarBind.length != varBindList.size()) { 1047 internalVarBind = new SnmpVarBind[varBindList.size()]; 1048 } 1049 varBindList.copyInto(internalVarBind); 1050 } 1051 1052 1055 final synchronized void setErrorStatusAndIndex(int stat, int idx) { 1056 errorStatus = stat; 1057 errorIndex = idx; 1058 } 1059 1060 1063 final synchronized void setPrevPollTime(long prev) { 1064 prevPollTime = prev; 1065 } 1066 1067 1070 final void setRequestSentTime(long sendtime) { 1071 numTries++; 1072 setPrevPollTime(sendtime); 1073 waitTimeForResponse = prevPollTime + timeout*numTries; 1074 setRequestStatus(stWaitingForReply); 1075 1076 if (isTraceOn()) { 1077 trace("setRequestSentTime", "Inform request Successfully sent"); 1078 } 1079 1080 informSession.getSnmpQManager().addWaiting(this); 1081 } 1082 1083 1086 final synchronized void initNewRequest() { 1087 requestId = requestCounter.getNewId(); 1088 } 1089 1090 1093 long timeRemainingForAction(long currtime) { 1094 switch (reqState) { 1095 case stWaitingToSend : 1096 return nextPollTime - currtime; 1097 case stWaitingForReply : 1098 return waitTimeForResponse - currtime; 1099 default : 1100 return -1; 1101 } 1102 } 1103 1104 1109 final static String statusDescription(int state) { 1110 switch (state) { 1111 case stWaitingToSend : 1112 return "Waiting to send."; 1113 case stWaitingForReply : 1114 return "Waiting for reply."; 1115 case stReceivedReply : 1116 return "Response arrived."; 1117 case stAborted : 1118 return "Aborted by user."; 1119 case stTimeout : 1120 return "Timeout Occured."; 1121 case stInternalError : 1122 return "Internal error."; 1123 case stResultsAvailable : 1124 return "Results available"; 1125 case stNeverUsed : 1126 return "Inform request in createAndWait state"; 1127 } 1128 return "Unknown inform request state."; 1129 } 1130 1131 1135 final synchronized void setRequestStatus(int reqst) { 1136 reqState = reqst; 1137 } 1138 1139 1143 public synchronized String toString() { 1144 StringBuffer s = new StringBuffer (300) ; 1145 s.append(tostring()) ; 1146 s.append("\nPeer/Port : " + address.getHostName() + "/" + port) ; 1147 1148 return s.toString() ; 1149 } 1150 1151 private synchronized String tostring() { 1152 StringBuffer s = new StringBuffer ("InformRequestId = " + requestId); 1153 s.append(" " + "Status = " + statusDescription(reqState)); 1154 s.append(" Timeout/MaxTries/NumTries = " + timeout*numTries + "/" + 1155 + getMaxTries() + "/" + numTries); 1156 1157 if (prevPollTime > 0) { 1158 debugDate.setTime(prevPollTime); 1159 s.append("\nPrevPolled = " + debugDate.toString()); 1160 } else 1161 s.append("\nNeverPolled"); 1162 s.append(" / RemainingTime(millis) = " + 1163 timeRemainingForAction(System.currentTimeMillis())); 1164 1165 return s.toString(); 1166 } 1167 1168 1171 boolean isTraceOn() { 1172 return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_ADAPTOR_SNMP); 1173 } 1174 1175 void trace(String clz, String func, String info) { 1176 Trace.send(Trace.LEVEL_TRACE, Trace.INFO_ADAPTOR_SNMP, clz, func, info); 1177 } 1178 1179 void trace(String func, String info) { 1180 trace(dbgTag, func, info); 1181 } 1182 1183 boolean isDebugOn() { 1184 return Trace.isSelected(Trace.LEVEL_DEBUG, Trace.INFO_ADAPTOR_SNMP); 1185 } 1186 1187 void debug(String clz, String func, String info) { 1188 Trace.send(Trace.LEVEL_DEBUG, Trace.INFO_ADAPTOR_SNMP, clz, func, info); 1189 } 1190 1191 void debug(String clz, String func, Throwable exception) { 1192 Trace.send(Trace.LEVEL_DEBUG, Trace.INFO_ADAPTOR_SNMP, clz, func, exception); 1193 } 1194 1195 void debug(String func, String info) { 1196 debug(dbgTag, func, info); 1197 } 1198 1199 void debug(String func, Throwable exception) { 1200 debug(dbgTag, func, exception); 1201 } 1202 1203} 1204 | Popular Tags |