[SNMP4J] DefaultMOServer Problem-method wait() doesn't exist!
Frank Fock
fock at agentpp.com
Mon Jul 17 18:43:47 CEST 2006
Hi Nídia,
Have you tested the fix? It works for me.
How do you create the row with createAndWait(5)
or createAndGo(4)?
That the table model processes sub-requests is OK
and part of the design.
Best regards,
Frank
Nídia S. Campos wrote:
> Hi Frank,
> Thank you very much for responde me, but ,the code below doesn't fixe
> the problem. When I start TestAgent and try to create a row with a
> Set-Request, it adds a lock on DefaultMOTable (snmpTArgetAddrTable) for
> each Subrequest and it never comes to commit phase. If I try again, it
> stops at that 'Waiting for lock on DefaultMOTable' message for the first
> SubRequest.
>
> SnmpTargetAddrTAble has a validator for each column, so, it must need
> all values to create a new row. If you add a new row using
> SnmpTargetMIB.addTargetAddr(), it works. But, if you do this remotelly,
> it doesn't work because DefaultMOTable only update or create rows using
> one column, that's it, one SubRequest. Then DefaultMOTableModel's
> prepare method doesn't work for SnmpTargetAddrTable beacuse it only
> processes SubRequests.
>
> So I think for table rows that must need all columns values to be
> created, DefaultMOTableModel's prepare method must receive a Request.
>
> What do you think?
>
> Best Regards,
> Nídia
>
> On 7/14/06, *Frank Fock* < fock at agentpp.com <mailto:fock at agentpp.com>>
> wrote:
>
> Hi Nídia,
>
> There is a regression bug in DefaultMOTableModel's prepare method
> which does not set the phase completion state on preparation success.
>
> The code below fixes the problem:
>
> public void prepare(SubRequest request) {
> OID cellOID = request.getVariableBinding().getOid();
> MOTableCellInfo cell = getCellInfo(cellOID);
> if (cell.getIndex() == null) {
> request.getStatus().setErrorStatus(PDU.inconsistentName);
> return;
> }
> if ((cell.getColumn() >= 0) && (cell.getColumn() <
> columns.length)) {
> MOColumn col = getColumn(cell.getColumn());
> if (logger.isDebugEnabled()) {
> logger.debug("Preparing sub-request
> ("+request.getVariableBinding()+")"+
> " for column: "+col);
> }
> if (col instanceof MOMutableColumn) {
> MOMutableColumn mcol = (MOMutableColumn)col;
> // check index
> if (getIndexDef().isValidIndex(cell.getIndex ())) {
> MOTableRow row = model.getRow(cell.getIndex());
> if (row == null) {
> // look for already prepared row
> row = (MOTableRow)
> getNewRows(request.getRequest()).get(cell.getIndex());
> }
> if (row != null) {
> prepare(request, cell, mcol, row, false);
> request.completed();
> return;
> }
> else if (model instanceof MOMutableTableModel) {
> if (logger.isDebugEnabled()) {
> logger.debug("Trying to create new row
> '"+cell.getIndex()+"'");
> }
> MOMutableTableModel mmodel = (MOMutableTableModel)model;
> // create new row
> try {
> row = createRow(request, cell, mmodel);
> prepare(request, cell, mcol, row, true);
> request.completed();
> }
> catch (UnsupportedOperationException ex) {
> request.getStatus().setErrorStatus(PDU.noCreation);
> }
> }
> else {
> request.getStatus().setErrorStatus(PDU.noCreation);
> }
> }
> else {
> // invalid index
> if (logger.isDebugEnabled()) {
> logger.debug("Invalid index '"+cell.getIndex()+
> "' for row creation in table "+getID());
> }
> request.getStatus().setErrorStatus(PDU.noCreation);
> }
> }
> else {
> // read-only column
> request.getStatus ().setErrorStatus(PDU.notWritable);
> }
> }
> else {
> request.getStatus().setErrorStatus(PDU.noCreation);
> }
> }
>
>
> A new beta release will be available soon on the
> SNMP4J web site.
>
> Best regards,
> Frank
>
> Nídia S. Campos wrote:
> > Hi,
> > I am trying to add a entry in snmpTargetAddrTable using community
> 'public'.
> > When VACM MIB allows access for view 'fullWriteView', TestAgent
> stops
> > with :
> >
> > 214254 [RequestPool.3] DEBUG org.snmp4j.agent.DefaultMOServer -
> Waiting
> > for
> > lock on DefaultMOTable[id=1.3.6.1.6.3.12.1.2.1,index=
> > org.snmp4j.agent.mo.snmp.SnmpTargetMIB$2 at 1ded0fd ,columns=[
> >
> org.snmp4j.agent.mo.MOMutableColumn[columnID=2,syntax=6,default=,mode=],
> >
> org.snmp4j.agent.mo.MOMutableColumn[columnID=3,syntax=4,default=,mode=],
> >
> org.snmp4j.agent.mo.MOMutableColumn[columnID=4,syntax=2,default=1500,mode=],
>
> >
> >
> org.snmp4j.agent.mo.MOMutableColumn[columnID=5,syntax=2,default=3,mode=],
> >
> org.snmp4j.agent.mo.snmp.SnmpTagList[columnID=6,syntax=4,default=,mode=],
> >
> org.snmp4j.agent.mo.MOMutableColumn[columnID=7,syntax=4,default=,mode=],
>
> >
> org.snmp4j.agent.mo.snmp.StorageType[columnID=8,syntax=2,default=3,mode=],
> >
> org.snmp4j.agent.mo.snmp.RowStatus[columnID=9,syntax=2,default=null,mode=]]]
> >
> >
> >
> > So, this messages comes from
> org.snmp4j.agent.DefaultMOServe.lock(Object
> > owner, ManagedObject managedObject) at this condition:
> > else if (lock.getOwner() != owner) {
> > try {
> > if (logger.isDebugEnabled ()) {
> > logger.debug("Waiting for lock on "+managedObject);
> > }
> > wait();
> > }
> > catch (InterruptedException ex) {
> > /**@todo logging*/
> > break;
> > }
> > }
> >
> >
> > This methode wait() doesn't exist, so TestAgent stops at
> > org.snmp4j.agent.CommanderProcessor.
> > SetHandler.prepare (OctetString context, Request request,
> MOServer server).
> >
> > Please, may someone help me?
> >
> > Thanks in advance,
> > Nídia
> > _______________________________________________
> > SNMP4J mailing list
> > SNMP4J at agentpp.org <mailto:SNMP4J at agentpp.org>
> > http://lists.agentpp.org/mailman/listinfo/snmp4j
> <http://lists.agentpp.org/mailman/listinfo/snmp4j>
>
> --
> AGENT++
> http://www.agentpp.com <http://www.agentpp.com>
> http://www.mibexplorer.com
> http://www.mibdesigner.com
>
>
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list