test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 52949 c78a17d24618
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    42   if (strcmp(className,CLASS_NAME) == 0) {
    42   if (strcmp(className,CLASS_NAME) == 0) {
    43       char fileName[512];
    43       char fileName[512];
    44 
    44 
    45       nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char));
    45       nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char));
    46       nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL);
    46       nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL);
    47       if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName) == NSK_TRUE) {
    47       if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) {
    48           nsk_printf("Redefine successful ..\n");
    48           nsk_printf("Redefine successful ..\n");
    49       } else {
    49       } else {
    50           nsk_printf("Redefine failed ..     \n");
    50           nsk_printf("Redefine failed ..     \n");
    51       }
    51       }
    52   }
    52   }
    75         return JNI_ERR;
    75         return JNI_ERR;
    76     } else {
    76     } else {
    77         jvmtiCapabilities caps;
    77         jvmtiCapabilities caps;
    78         jvmtiEventCallbacks eventCallbacks;
    78         jvmtiEventCallbacks eventCallbacks;
    79 
    79 
    80         if (nsk_jvmti_parseOptions(options) == NSK_FALSE) {
    80         if (!nsk_jvmti_parseOptions(options)) {
    81             nsk_printf("# error agent Failed to parse options \n");
    81             nsk_printf("# error agent Failed to parse options \n");
    82             return JNI_ERR;
    82             return JNI_ERR;
    83         }
    83         }
    84 
    84 
    85         memset(&caps, 0, sizeof(caps));
    85         memset(&caps, 0, sizeof(caps));
    91         rc=jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks));
    91         rc=jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks));
    92         if (rc != JVMTI_ERROR_NONE) {
    92         if (rc != JVMTI_ERROR_NONE) {
    93             nsk_printf(" Agent:: Error occured while setting event call back \n");
    93             nsk_printf(" Agent:: Error occured while setting event call back \n");
    94             return JNI_ERR;
    94             return JNI_ERR;
    95         }
    95         }
    96         if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL) == NSK_TRUE) {
    96         if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) {
    97             nsk_printf(" Enabled. noftification..");
    97             nsk_printf(" Enabled. noftification..");
    98         } else {
    98         } else {
    99             nsk_printf(" Failed to Enable ..");
    99             nsk_printf(" Failed to Enable ..");
   100         }
   100         }
   101     }
   101     }