FileChannel and mapping files

Hello,
I'have some strange problem with mapping file using a FileChannel and the map method.
My program creates some number of threads. These threads are accessing in a file (in a different places) to write down some information. The number of the created threads is about (max) 100 but at one moment I may have for example from 1 to 60 threads that are active.
Sometimes when a thread tries to map some region from the file, I have an exception.
So here is my code:
FileChannel fch = rafOut.getChannel();
try {
position = rafOut.getChannel().position();
//I have the exception here fch.map(....)
mbf = fch.map(FileChannel.MapMode.READ_WRITE, position, Manager.getSize());
} catch (IOException e2) {
  e2.printStackTrace();
//here I'm using some putXXX() methods
//and at the and I have
mbf.force();
}This code sometimes generates this exception:
java.io.IOException: The requested operation over a mapped file was not accomplished
     at sun.nio.ch.FileChannelImpl.truncate0(Native Method)
     at sun.nio.ch.FileChannelImpl.map(Unknown Source)
     at DataWriter.run(DataWriter.java:40)
Any idea why I have this error?
Regards,
Anton
PS. The first part of the exception message was written in French, so I tried to translated it :)
Edited by: anton_tonev on Nov 5, 2007 6:49 AM

Hi ejp,
i'm trying to extend the file. In the begging the file is empty, so every thread adds data to the file.
About the mapping, yes I know that map many times the same file is not the right solution ... but for every thread I'm mapping a different part of the file, for exemple :
one thread maps from 0 byte to the 256 byte and writes there the data.
another thread maps from 256 to 1024 and so on ...
The problem is that the threads don't know the size of the data before the mapping(e.g. the future size of the entire file), if it was known, may be I could map the entire file in the memory. And there is more thing, the file sometimes becomes very big .. a hundred of Gbs, so mapping just some parts of it in the memory for me is the best solution.
Regards,
Anton

Similar Messages

  • Making a .EVO and .MAP file using DVD studio Pro..............

    I am trying to make a .EVO and .MAP file using DVD Studio Pro. Please dont respond to this if you have no idea what this is. Dealing in real HD situaiton....trying to find a quick and dirty way to make these files as placeholders, was hoping DVD studio Pro could do it. Thanks.

    you cant make them using DVD Studi pro, since they are for TRULY 1080p (23.98fps) projects using vc1.
    funny thing is if you know about these files, you would also KNOW that DVDSP does not do this!
    i have seen this files on the toshiba GUI but have not seen them with the blu-ray authroing compile.
    also, i am going to have to say that if you are TRULY "Dealing in real HD situaiton." you wouldnt NEED DVDSP.
    so ease up with the chip and if you have a REAL question ask it, if yo uare just here to show your feathers.. not interested!

  • External List Management - Issue in File Upload and Map

    I am facing problem while maintaining external lists through ELM and executing step upload and map file for a tab separated text format file.
    The file data is getting shown properly in file preview through mapping format but when I execute it through external list the data is not getting uploaded at all.The log is not showing me any error or reason for the same.
    I want to know apart from basic ELM config, is there some other configuartion required to enable ELM to upload and map the file in turn.
    Message was edited by:
            Pratyasha Shishodia

    I got the resolution to this answer.
    The issue was the task under ELM workflow was not marked for background processing and hence it was always in ready state and never proceeded ahead thru ELM transaction.All the steps due  to this reason were shown in planned or ready state.
    There was no error in ELM as everything in the system had no issues and hence nothing came in error log.

  • How to read map file ?

    Hi,
       I have a linker map file having some data like below
       File name :Load.map
         2000b598   ABC
         20009672   bbb
      My requirement is to read  hex value when  an input is given.
      Inuts are "ABC" or "bbb" .
      Example: when input "bbb" is given then 20009672 needs to be displayed in  indicator.
      please let me know the solution as this is very urgent.
    Thanks in advance,
    krishna 
    Solved!
    Go to Solution.

    Linker file generated by Multi.
    Assuming my linker file having the following data
    File name : Load_3.0.map
    2000b598    Switch1
    2000b590    Switch2
    Now I want to read Switch2 address. When I read using match pattern I got the output as
     2000b598    Switch1
     2000b590
    But I am expecting output as  2000b590.
    Please find the attached vi and map file for your reference. I know I need to work around something but I'm snot sure what need to be done.
    Please modify Load_3.0.txt to "Load_3.0.map" due to an attachment error.
    Awaiting for your positive reply.
    Regards,
    krishna 
    Attachments:
    Read From Mapfile.vi ‏6 KB
    Load_3.0.txt ‏1 KB

  • Nio ByteBuffer and memory-mapped file size limitation

    I have a question/issue regarding ByteBuffer and memory-mapped file size limitations. I recently started using NIO FileChannels and ByteBuffers to store and process buffers of binary data. Until now, the maximum individual ByteBuffer/memory-mapped file size I have needed to process was around 80MB.
    However, I need to now begin processing larger buffers of binary data from a new source. Initial testing with buffer sizes above 100MB result in IOExceptions (java.lang.OutOfMemoryError: Map failed).
    I am using 32bit Windows XP; 2GB of memory (typically 1.3 to 1.5GB free); Java version 1.6.0_03; with -Xmx set to 1280m. Decreasing the Java heap max size down 768m does result in the ability to memory map larger buffers to files, but never bigger than roughly 500MB. However, the application that uses this code contains other components that require the -xMx option to be set to 1280.
    The following simple code segment executed by itself will produce the IOException for me when executed using -Xmx1280m. If I use -Xmx768m, I can increase the buffer size up to around 300MB, but never to a size that I would think I could map.
    try
    String mapFile = "C:/temp/" + UUID.randomUUID().toString() + ".tmp";
    FileChannel rwChan = new RandomAccessFile( mapFile, "rw").getChannel();
    ByteBuffer byteBuffer = rwChan.map( FileChannel.MapMode.READ_WRITE,
    0, 100000000 );
    rwChan.close();
    catch( Exception e )
    e.printStackTrace();
    I am hoping that someone can shed some light on the factors that affect the amount of data that may be memory mapped to/in a file at one time. I have investigated this for some time now and based on my understanding of how memory mapped files are supposed to work, I would think that I could map ByteBuffers to files larger than 500MB. I believe that address space plays a role, but I admittedly am no OS address space expert.
    Thanks in advance for any input.
    Regards- KJ

    See the workaround in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038

  • Sending Idocs from SAP-R/3 to XI, bundle and map them to one XML-file

    Hi All,
    We need to send IDoc's (DEBMAS06) from R/3 to XI and  bundle and map them to a single xml-file. Please help us with your suggestions on how to proceed using a simple solution (probably need of BPM).
    Regards,
    Theo

    Hi Theo,
    there is an example in SAP Library: <a href="http://help.sap.com/saphelp_nw04/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm">Collecting and Bundling Messages - One Interface</a>. Plz post us your detailed quetions.
    Regards,
    Udo

  • Why are Map IDs landing in Project Map File, not All Maps, and with a .h extension

    I am using the Tech Comm Ste 2, Adobe Robohelp 8.0.2.2  in Windows XP. I assign map IDs manually instead of using automap. I open the Edit Map IDs window. In the right column, under "Topic," I select the topic I want to map. I then click the icon below to open the Context-sensitive Properties for Help Topic window. I select the topic title, without the .htm, and copy it. Then, from the left column, I click the Map File dropdown list and select the HH file to which I want to map the help topic. I then click the icon at the bottom to open the Create/Edit Map ID window. In the first field, I paste the topic ID, and in the second field I enter the map ID I want to assign. Then I click OK.
    Usually this places the topic in the correct HH file, highlighted in yellow until I select the topic from the list and then click Assign. For some reason, RH is not adding my topic to the HH file; instead it is adding it to the Project Map file. When I click OK, I get a blank window and the Assign button is disabled. My topic shows up in the Project Map File. The topic displays with the HH files and a .h extension has been added to it.
    I can't delete these topics from the Project Map file. I can't assign them map IDs. And this seems to happen randomly. SOMETIMES I can map my topics, but I never know when I can do it and when one of them is going to land in the Project Map file.
    Can anyone help?

    Personally I've never had or heard of this issue. The fact that this appears to be random suggests that the MapFile dropdown may not be displaying the correct map file when you add or assign the mapid. Also check to ensure your project's source files are not located on a network drive as this can cause issues. If this continues perhaps you could give us an image of what you are seeing.
      The RoboColum(n)
      @robocolumn
      Colum McAndrew

  • Data from a file need to be read and mapped  into a custom table of R/3

    Hello all,
    This is related to inbound to  SAP ECC via SAP PI.
    There is a requirement concerning PI part that data from a file need to be read and mapped  into a custom table of R/3.
    To have this scenario developed , do we have any other  option than the Proxy ?
    My understanding is as follows : File --> SAP PI --> Proxy
    You suggestions are welcome.
    Regards,
    Rachana

    Hi Ravi,
    As suggested by Inaki, you can use proxy communication in recever.
    but you can also use the below
    FILE -----> PI -------> PROXY
                                  RFC
                                  IDOC
    to communicate to ECC system.
    Regards
    srinivas

  • Mapping and Interfacing files into R/3 as IDOCs using XI

    We are trying to send an IDOC into R/3 thru XI. We generated one from R/3 into XI - it worked fine, however the reverse direction is not working well.
    We are using XI 2.0 with R/3 4.6C.
    We ran into two problems:
    when we tried DEBMAS/DEBMAS06, we were getting a message in SXMB_MONI / IDX5 that the entry DEBMAS06 is not found (in table IDOCSYN) on XI. On our XI server we found that there were only 65 IDOC message types defined (I dont know why .. but none of the popular IDOC messages like DEBMAS, CREMAS, MATMAS, ORDERS, etc are in XI). We thought may be that is the reason. But we do not know thru config, how to add IDOC messages into XI - this is not the same as importing IDOC type .. we have already done that. Just importing an IDOC structure does not put an entry in tables like IDOCSYN, and others...
    Then we tried using an IDOC message that was in XI IDOC tables - FLIGHT_SAVEREPLICA. This ones gets past the error we got with DEBMAS. However, we still do not see the IDOC in R/3.  When we check IDX5 or SXMB_MONI, it says that the message is processed successfully and does not show any errors. We are not understanding why it does not reach R/3.
    Has anyone mapped files into IDOCs and sent to R/3 thru XI. If you did, CAN YOU PLEASE HELP US OUT....
    It looks like we are missing small config step .. somewhere ..
    We created partner profiles, set up ports and RFC destinations. IN SLD we did define the logical systems. On the surface, from the config everything seems fine.
    OSS note 669669 is already in.
    Any help will be greatly appreciated ...

    > We are trying to send an IDOC into R/3 thru XI. We
    > generated one from R/3 into XI - it worked fine,
    > however the reverse direction is not working well.
    > We are using XI 2.0 with R/3 4.6C.
    >
    > We ran into two problems:
    > when we tried DEBMAS/DEBMAS06, we were getting a
    > message in SXMB_MONI / IDX5 that the entry DEBMAS06
    > is not found (in table IDOCSYN) on XI. On our XI
    > server we found that there were only 65 IDOC message
    > types defined (I dont know why .. but none of the
    > popular IDOC messages like DEBMAS, CREMAS, MATMAS,
    > ORDERS, etc are in XI). We thought may be that is the
    > reason. But we do not know thru config, how to add
    > IDOC messages into XI - this is not the same as
    > importing IDOC type .. we have already done that.
    > Just importing an IDOC structure does not put an
    > entry in tables like IDOCSYN, and others...
    You need to change the outbound version to a lower version. ie send debmas03 not 06.
    This is an ALE to ALE issue. Not XI related.
    > Then we tried using an IDOC message that was in XI
    > IDOC tables - FLIGHT_SAVEREPLICA. This ones gets past
    > the error we got with DEBMAS. However, we still do
    > not see the IDOC in R/3.  When we check IDX5 or
    > SXMB_MONI, it says that the message is processed
    > successfully and does not show any errors. We are not
    > understanding why it does not reach R/3.
    >
    Trace time....
    > Has anyone mapped files into IDOCs and sent to R/3
    > thru XI. If you did, CAN YOU PLEASE HELP US OUT....
    >
    > It looks like we are missing small config step ..
    > somewhere ..
    >
    > We created partner profiles, set up ports and RFC
    > destinations. IN SLD we did define the logical
    > systems. On the surface, from the config everything
    > seems fine.
    > OSS note 669669 is already in.
    >
    > Any help will be greatly appreciated ...
    Use SXI_SUPPORT and follow it in debug...
    Cant tell what else is wrong.

  • PI 7.1 : Taking a input PDF file and mapping it to a hexBinary attribute

    Hello All,
    We have a requirement which involves taking in an input PDF file and mapping it to a message type with binary attribute and sending it to an R3 system.
    Can anyone please detail the steps or point us to the correct documents for setting up the scenario.
    The scenario is file to Proxy adapter. The part which we need assitance is pulling up the input pdf and mapping it to binary field.
    Thanks.
    Kiran

    Thanks Praveen,Mayank,Sarvesh and Andreas for your  valuable help with the issue.
    I was able to successfully pick up the binary PDF file from a file server , encode it using Base 64 and post it to R3.
    I used the following code snippet and added the mentioned jar files to create a new jar file which was used as java mapping in the operation mapping.
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.*;
    import com.sap.aii.utilxi.base64.api.*;
    import java.io.*;
    import java.util.*;
    public class Base64EncodingXIStandard implements StreamTransformation{
         String fileNameFromFileAdapterASMA;
         private Map param;
         public void setParameter (Map map)
              param = map;
              if (param == null)
                   param = new HashMap();
         public static void main(String args[])
              Base64EncodingXIStandard con = new Base64EncodingXIStandard();
              try
                   InputStream is = new FileInputStream(args[0]);
                   OutputStream os = new FileOutputStream(args[1]);
                   con.execute(is, os);
              catch (Exception e)
                   e.printStackTrace();
    public void execute(InputStream inputstream, OutputStream outputstream)
                   DynamicConfiguration conf = (DynamicConfiguration) param.get("DynamicConfiguration");
                   DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
                   fileNameFromFileAdapterASMA = conf.get(KEY_FILENAME);
                   if (fileNameFromFileAdapterASMA == null)
                        fileNameFromFileAdapterASMA = "ToBase64.txt";
              try
                   while ((len = inputstream.read(buffer)) > 0)
                        baos.write(buffer, 0, len);
                   str = Base64.encode(baos.toByteArray());     //buffer);
                   outputstream.write("<?xml version=\"1.0\" encoding=\"utf-8\"?><ROOT>".getBytes());
                   outputstream.write(("<FILENAME>" + fileNameFromFileAdapterASMA + "</FILENAME>").getBytes());
                   outputstream.write( ("<BASE64DATA>" + str + "</BASE64DATA></ROOT>" ).getBytes());
              catch(Exception e)
                   e.printStackTrace();
         byte[] buffer = new byte[1024*5000];
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         int len;
         String str = null;
    I had to do the following configuration settings
    1)  Create a Sender Comm Channel with Adapter Specific message attributes and Filename checkbox checked.
    2) Use the Java Mapping in the Operation mapping.
    The scenario is working smoothly with out any issues.
    Thanks.
    Kiran

  • Problem in Creating .wsdl file and mapping.xml with ant

    hi
    i am created my .wsdl file and mapping.xml file with wscompile tool but when i run this by ant tool it show a problem.
    the command runs on command prompt but when run throught ant file it shows a following error :-
    Execute failed: java.io.IOException: CreateProces: wscompile -define -mapping build\classes\META-INF\mapping.xml -d . -nd build\.................and so on
    so if anybody have any idea then plz help me asap
    thanx

    The following Ant snippet is the way I've defined my wscompile task. I'm creating a web application and it looks like yours might be an EJB endpoint, but you can adjust where necessary:
    <taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile">
         <classpath refid="compile.classpath" />
    </taskdef>
    <target name="init">
         <echo message="-------- ${appname} --------" />
    </target>
    <!-- This target compiles the server components using an existing WSDL as the driving document.
           The configuration file must use the <wsdl> element giving the location (local file system
           or URL) of the WSDL document.
           Note: the fork argument is needed to over come a bug when using the mapping argument. See
           http://forum.java.sun.com/thread.jspa?threadID=592994&tstart=0
      -->
         <target name="generate-server-from-WSDL" depends="init">
              <wscompile fork="yes"
                           keep="true"
                           base="${basedir}/WebContent/WEB-INF/classes"
                           import="true"
                           features="wsi"
                           xPrintStackTrace="true"
                           verbose="true"
                           mapping="${basedir}/WebContent/WEB-INF/jaxrpc-mapping.xml"
                           sourcebase="${basedir}/src"
                           config="${config.server.doclit.file}">
                   <classpath>
                        <path refid="compile.classpath" />
                   </classpath>
              </wscompile>
         </target>
         <target name="compile-server-from-WSDL" depends="generate-server-from-WSDL">
              <javac srcdir="${basedir}/src" destdir="${basedir}/WebContent/WEB-INF/classes" debug="${compile.debug}">
                   <classpath refid="compile.classpath" />
              </javac>
         </target>Just make sure that the named destination directories exist before you run the script.
    If you'd like more details on the wscompile Ant task, I found the following pages invaluable:
    https://jax-rpc.dev.java.net/whitepaper/1.1/index-part1.html

  • Combining 2 files and mapping it to a single destination file

    hi all;
    if i am combining 2 files and mapping it to a single destination file then do we need to define 2 sender communication channels and 1 receiver communication channel

    i have done with the BPM.
    steps
    1 Block with corelation name
    2 Fork with end condition counter not equal 2
    3 fork branch 1 -- receive with corelation and container incrementing count by 1
      fork branch 2 -- receive with corelation and container incrementing count by 1
    4 transformation
    5 send
    i have source file structure during mapping:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
          <ns1:SenderData1 xmlns:ns1="http://multimapping.com">
             <Name>AAAA</Name>
          </ns1:SenderData1>
       </ns0:Message1>
       <ns0:Message2>
          <ns1:SenderData2 xmlns:ns1="http://multimapping.com">
             <Name>BBBB</Name>
          </ns1:SenderData2>
       </ns0:Message2>
    </ns0:Messages>
    i breaked the structure in 2 and placed it in different files
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:SenderData1 xmlns:ns0="http://multimapping.com">
       <Name>AAAA</Name>
    </ns0:SenderData1>
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:SenderData2 xmlns:ns0="http://multimapping.com">
       <Name>BBBB</Name>
    </ns0:SenderData2>
    is that all to be done

  • Subfolders in Map Files and Baggage?

    Using Robo 6 to create webhelp. This is one of many issues I'm seeing since inheriting this help project that had not been updated in 2+ years.
    Today's question is, why are the topic folder names that I use to organize my content being re-created under Map IDs and Baggage? I have 5 folders under HTML Files (Topics) and these same folder names show up under Map Files and Baggage files, and they are empty. Also one HTMLPages folder is showing up that isnt' even in my help project. I have 5 other stand-alone help pages that I use Robo to maintain but they are in a completely different folder, outside of the Help project fodler.
    I only have one map ID file and no baggage files. But it won't let me delete these "extra folders under Map Files and Baggage fiels so clearly it thinks they are needed.
    thankyouverymuch...

    Hi there
    You have to understand the way RoboHelp works with these. Note the folders have icons on them. The Baggage and Image folders. This means they aren't true folders you will see in the Windows file system. This means RoboHelp is simply presenting what it knows about in that category. So when you create a folder in your project, you are creating a true folder in the Windows File System. It is then visible in the other "pseudo-folders" presented by RoboHelp.
    Perhaps this link will help. Click here
    Does that make more sense? Rick
    Click here for Adobe Authorized Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Map files and map IDs

    This question was posted in response to the following article: http://help.adobe.com/en_US/robohelp/robohtml/WS5b3ccc516d4fbf351e63e3d11aff59c571-7ff9.ht ml

    Typo in this section:
    Remove an unused map ID
    Your map files must be unlocked to use this option. To remove unused map IDs:
    Expand the Context-Sensitive Help folder in the Project Set-up pod.
    Right-click the Map Files folder.
    Select Edit.
    Do the following:
    Map Files Select the map files from which to remove unused map IDs.
    Select All Click to remove unused map IDs from all map files.
    Clear All Click to deselect all map files and not remove unused map IDs.
    The third point should read "Select Remove Unused Map IDs..." instead of "Select Edit"; then the rest of the topic makes sense.

  • I installed a game, where can i find the files and maps? where does iMac store this data?

    I installed a game,Now I need to add some files however, I cannot find where iMac stores it.. where can i find the files and maps? where does iMac store this data?
    thx alot
    erik

    Depends on game, i would look first on the game file itself, right click (or ctrl click) the game file you installed (Applications?) and select show package contents, its usually a application bundle, as in basicly a folder where the application and the required files and subfolders are.

Maybe you are looking for

  • Web sites with flash don't work

    I just got a new 20" iMac with the Duo 2 Core chip. I'm having problem with wed sites that run flash not working with Safari. Try reinstalling Flash 9, but no like. I tried useding Camino and have no problems. So I know that it is a problem with Safa

  • To link MKPF and BKPF Tables.

    Hi Experts, I basically need to retieve all the accounting documents posted for a particular material document. How is this possible ? Regards, Sunitha

  • Creating titles in Photoshop

    Hello, There are times I want to create titles in photoshop or fireworks and import into iMovie. When I do them @ 640x480, they come in all messed up. They look fine on QT Pro. What is the best way to do this for iMovieHD 6? Is there a template that

  • CRM MDM Integration

    Hi SDNers,                     We have  to integrate SAP CRM (Ver 5.0 )  and SAP MDM ( MDM 5.5 SP 06). Any idea , suggestion or work around for this integration?? Thanks & Regards, Shreya Landge.

  • Installing Photoshop CS6 on Three Computers

    Hi, I have three computers, One Desktop as my main production machine, one 17" Laptop as my Studio Shooting machine and a 15" as my travel machine.  I would like to install Photoshop CS6 all on three machines but using only one at a time.  At the mom