Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

verify code the method recursive

Posted on 2011-05-12
12
Medium Priority
?
237 Views
Last Modified: 2012-05-11
Hi experts, I have a save process that are 6 methods.
 1. The first 4 saved in the database
 2. The 5th method calls a web services and this can take between 30 seconds and 90 seconds, but you may not bring the information, then did a recursive method ObtenerUsuarioEstacion
 3. Saved in the database of information brought web services.

 I copy the code of the recursive method for me to indicate if the lake more to be done for this to work properly. Thanks

    Public Sub ActualizarUsuarioEstacion(ByVal strNumeroUltimus As String)

        If String.IsNullOrEmpty(strNumeroUltimus) Then Exit Sub
        ObtenerUsuarioEstacion(strNumeroUltimus)

    End Sub

Public Sub ObtenerUsuarioEstacion(ByVal strNumeroUltimus As String)
...

        intEstadoIncidentesUlt = EConstante.eFilter.nFilter_Current
        Dim usuarioEstacion As String = objLogicBandeja.fArrObtenerUsuarioEstacionDestino(Constantes.ProcesoRIG, intEstadoIncidentesUlt, WFGDHUtilitario.ObtieneKeyWebConfig("wsUltimusWBC"), strNumeroUltimus.Replace("RI-", ""))

        If String.IsNullOrEmpty(usuarioEstacion) Then
            ObtenerUsuarioEstacion(strNumeroUltimus)
        Else
            usuarioEstacion.Trim()
            If usuarioEstacion.Length > 0 Then
                arrDatosDestino = usuarioEstacion.Split("-")
                estacion = arrDatosDestino(0).ToString
                codigoUsuario = arrDatosDestino(1).ToString
                nombreUsuario = arrDatosDestino(2).ToString

                If (nombreUsuario = "S129VD_FLOBOT" Or estacion = "Activar R&S") Then
                    estacion = "6.1 Revision de Perfil"
                    codigoUsuario = "grupoib.local/b12766"
                    nombreUsuario = "Hirakawa Shirakawa, Ana"
                End If

                Dim oLIncrementoPlanta As New LIncrementoPlanta
                oLIncrementoPlanta.ActualizarUserEstacion(Solicitud.intIdNumeroProvision, estacion, codigoUsuario, nombreUsuario)
                Exit Sub
            End If

        End If

    End Sub
0
Comment
Question by:enrique_aeo
  • 7
  • 5
12 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35748829
A huge problem with your questions is that all function/variable/class names are in a language other than English so the code does not make any sense to majority of the experts here including me.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35748850
Though by the looks of it, the code in ObtenerUsuarioEstacion function looks fine.
0
 

Author Comment

by:enrique_aeo
ID: 35749159
function is recursive. what if the Web service returns no data I need? what happens if you spend 1 hour and the web service returns no data? increases server memory?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 35749183
You will probably get a StackOverFlow exception well before an hour.
0
 

Author Comment

by:enrique_aeo
ID: 35749185
and how I can control that?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35749216
> what happens if you spend 1 hour and the web service returns no data?
Sorry did you mean 1 hour of recursive calls or 1 hour of waiting for reply from service?
0
 

Author Comment

by:enrique_aeo
ID: 35749258
function is recursive and will leave there when the web service returns the information. Said 1 hour per exaggerate.
Currently it takes 90 seconds. I know how to handle the error, ie, that code should put in my try catch?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35749289
Yes. And may be a global exception handler as well to prevent app from crashing.
0
 

Author Comment

by:enrique_aeo
ID: 35749380
and can provide the code?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 2000 total points
ID: 35749389
0
 

Author Comment

by:enrique_aeo
ID: 35749875
and why to be a global exception handler?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 2000 total points
ID: 35752678
>and why to be a global exception handler?
You mean why use a global exception handler? It will save your application from crashing and you will catch all exceptions which are raised outside your try catch blocks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question